after_merge
stringlengths
28
79.6k
before_merge
stringlengths
20
79.6k
url
stringlengths
38
71
full_traceback
stringlengths
43
922k
traceback_type
stringclasses
555 values
def create(self): if self.can_be_inline: self.create_inline() else: self.create_via_sub_process() # TODO: cleanup activation scripts for lib in self.libs: ensure_dir(lib) super(Venv, self).create()
def create(self): if self.can_be_inline: self.create_inline() else: self.create_via_sub_process() # TODO: cleanup activation scripts for lib in self.libs: ensure_dir(lib)
https://github.com/pypa/virtualenv/issues/1635
~ % source venv/bin/activate source: no such file or directory: venv/bin/activate ~ % source venv/usr/local/opt/python@3.6.8/bin/activate (venv) ~ % pip list Traceback (most recent call last): File "/Users/csalch/venv/usr/local/opt/python@3.6.8/bin/pip", line 5, in <module> from pip._internal.cli.main import main Modul...
ModuleNotFoundError
def copyfile(src, dest, symlink=True): if symlink and hasattr(os, "symlink") and not IS_WIN: return symlink_file_or_folder(src, dest) if not os.path.exists(src): # Some bad symlink in the src logger.warn("Cannot find file %s (bad symlink)", src) return if os.path.exists(dest)...
def copyfile(src, dest, symlink=True): if not os.path.exists(src): # Some bad symlink in the src logger.warn("Cannot find file %s (bad symlink)", src) return if os.path.exists(dest): logger.debug("File %s already exists", dest) return if not os.path.exists(os.path.dir...
https://github.com/pypa/virtualenv/issues/490
Symlinking Python bootstrap modules Symlinking /lib/python2.7/config -> /src/build/firefox/mozilla-release/firefox-build-dir/_virtualenv/lib/python2.7/config Symlinking /lib/python2.7/lib-dynload -> /src/build/firefox/mozilla-release/firefox-build-dir/_virtualenv/lib/python2.7/lib-dynload Symlinking /lib/python2.7/os.p...
IOError
def replacements(self, creator, dest_folder): replacements = super(PythonActivator, self).replacements(creator, dest_folder) site_dump = json.dumps( list({os.path.relpath(str(i), str(dest_folder)) for i in creator.libs}), indent=2, ) replacements.update({"__SITE_PACKAGES__": site_dump}) ...
def replacements(self, creator, dest_folder): replacements = super(PythonActivator, self).replacements(creator, dest_folder) site_dump = json.dumps( [os.path.relpath(str(i), str(dest_folder)) for i in creator.site_packages], indent=2, ) replacements.update({"__SITE_PACKAGES__": site_dump...
https://github.com/pypa/virtualenv/issues/1332
$ <scl_base>/bin/virtualenv --python <scl_base>/bin/python --always-copy --verbose TEST Running virtualenv with interpreter <scl_base>/bin/python Using base prefix '<scl_base>' Creating <somedir>/TEST/lib/python3.6 Copying to <somedir>/TEST/lib64 Symlinking Python bootstrap modules Copying to <somedir>/TEST/lib/python3...
ModuleNotFoundError
def replacements(self, creator, dest_folder): return { "__VIRTUAL_PROMPT__": "" if self.flag_prompt is None else self.flag_prompt, "__VIRTUAL_ENV__": six.ensure_text(str(creator.dest_dir)), "__VIRTUAL_NAME__": creator.env_name, "__BIN_NAME__": six.ensure_text( str(creator...
def replacements(self, creator, dest_folder): return { "__VIRTUAL_PROMPT__": "" if self.flag_prompt is None else self.flag_prompt, "__VIRTUAL_ENV__": six.ensure_text(str(creator.dest_dir)), "__VIRTUAL_NAME__": creator.env_name, "__BIN_NAME__": six.ensure_text(str(creator.bin_name)), ...
https://github.com/pypa/virtualenv/issues/1332
$ <scl_base>/bin/virtualenv --python <scl_base>/bin/python --always-copy --verbose TEST Running virtualenv with interpreter <scl_base>/bin/python Using base prefix '<scl_base>' Creating <somedir>/TEST/lib/python3.6 Copying to <somedir>/TEST/lib64 Symlinking Python bootstrap modules Copying to <somedir>/TEST/lib/python3...
ModuleNotFoundError
def is_fs_case_sensitive(): global _FS_CASE_SENSITIVE if _FS_CASE_SENSITIVE is None: with tempfile.NamedTemporaryFile(prefix="TmP") as tmp_file: _FS_CASE_SENSITIVE = not os.path.exists(tmp_file.name.lower()) logging.debug( "filesystem under %r is %scase-sensitive...
def is_fs_case_sensitive(): global _FS_CASE_SENSITIVE if _FS_CASE_SENSITIVE is None: with tempfile.NamedTemporaryFile(prefix="TmP") as tmp_file: _FS_CASE_SENSITIVE = not os.path.exists(tmp_file.name.lower()) logging.debug( "filesystem under is %r%s case-sensitive...
https://github.com/pypa/virtualenv/issues/1332
$ <scl_base>/bin/virtualenv --python <scl_base>/bin/python --always-copy --verbose TEST Running virtualenv with interpreter <scl_base>/bin/python Using base prefix '<scl_base>' Creating <somedir>/TEST/lib/python3.6 Copying to <somedir>/TEST/lib64 Symlinking Python bootstrap modules Copying to <somedir>/TEST/lib/python3...
ModuleNotFoundError
def __init__(self, options, interpreter): self.interpreter = interpreter self._debug = None self.dest_dir = Path(options.dest_dir) self.enable_system_site_package = options.system_site self.clear = options.clear self.pyenv_cfg = PyEnvCfg.from_folder(self.dest_dir) self._stdlib = None se...
def __init__(self, options, interpreter): self.interpreter = interpreter self._debug = None self.dest_dir = Path(options.dest_dir) self.enable_system_site_package = options.system_site self.clear = options.clear self.pyenv_cfg = PyEnvCfg.from_folder(self.dest_dir)
https://github.com/pypa/virtualenv/issues/1332
$ <scl_base>/bin/virtualenv --python <scl_base>/bin/python --always-copy --verbose TEST Running virtualenv with interpreter <scl_base>/bin/python Using base prefix '<scl_base>' Creating <somedir>/TEST/lib/python3.6 Copying to <somedir>/TEST/lib64 Symlinking Python bootstrap modules Copying to <somedir>/TEST/lib/python3...
ModuleNotFoundError
def set_pyenv_cfg(self): self.pyenv_cfg.content = { "home": self.interpreter.system_exec_prefix, "include-system-site-packages": "true" if self.enable_system_site_package else "false", "implementation": self.interpreter.implementation, "version_info": ".".join(str(i) ...
def set_pyenv_cfg(self): self.pyenv_cfg.content = { "home": self.interpreter.system_exec_prefix, "include-system-site-packages": "true" if self.enable_system_site_package else "false", "implementation": self.interpreter.implementation, "virtualenv": __version__, }...
https://github.com/pypa/virtualenv/issues/1332
$ <scl_base>/bin/virtualenv --python <scl_base>/bin/python --always-copy --verbose TEST Running virtualenv with interpreter <scl_base>/bin/python Using base prefix '<scl_base>' Creating <somedir>/TEST/lib/python3.6 Copying to <somedir>/TEST/lib64 Symlinking Python bootstrap modules Copying to <somedir>/TEST/lib/python3...
ModuleNotFoundError
def run(): """print debug data about the virtual environment""" try: from collections import OrderedDict except ImportError: # pragma: no cover # this is possible if the standard library cannot be accessed # noinspection PyPep8Naming OrderedDict = dict # pragma: no cover ...
def run(): """print debug data about the virtual environment""" try: from collections import OrderedDict except ImportError: # pragma: no cover # this is possible if the standard library cannot be accessed # noinspection PyPep8Naming OrderedDict = dict # pragma: no cover ...
https://github.com/pypa/virtualenv/issues/1332
$ <scl_base>/bin/virtualenv --python <scl_base>/bin/python --always-copy --verbose TEST Running virtualenv with interpreter <scl_base>/bin/python Using base prefix '<scl_base>' Creating <somedir>/TEST/lib/python3.6 Copying to <somedir>/TEST/lib64 Symlinking Python bootstrap modules Copying to <somedir>/TEST/lib/python3...
ModuleNotFoundError
def ensure_directories(self): return super(PyPy, self).ensure_directories() | {self.lib_pypy}
def ensure_directories(self): dirs = super(PyPy, self).ensure_directories() dirs.add(self.lib_pypy) return dirs
https://github.com/pypa/virtualenv/issues/1332
$ <scl_base>/bin/virtualenv --python <scl_base>/bin/python --always-copy --verbose TEST Running virtualenv with interpreter <scl_base>/bin/python Using base prefix '<scl_base>' Creating <somedir>/TEST/lib/python3.6 Copying to <somedir>/TEST/lib64 Symlinking Python bootstrap modules Copying to <somedir>/TEST/lib/python3...
ModuleNotFoundError
def _shared_lib_to(self): return super(PyPy3, self)._shared_lib_to() + [self.stdlib.parent.parent]
def _shared_lib_to(self): return super(PyPy3, self)._shared_lib_to() + [self.dest_dir / self.lib_name]
https://github.com/pypa/virtualenv/issues/1332
$ <scl_base>/bin/virtualenv --python <scl_base>/bin/python --always-copy --verbose TEST Running virtualenv with interpreter <scl_base>/bin/python Using base prefix '<scl_base>' Creating <somedir>/TEST/lib/python3.6 Copying to <somedir>/TEST/lib64 Symlinking Python bootstrap modules Copying to <somedir>/TEST/lib/python3...
ModuleNotFoundError
def __init__(self, options, interpreter): self.builtin_way = options.builtin_way super(Venv, self).__init__(options, interpreter) self.can_be_inline = ( interpreter is CURRENT and interpreter.executable == interpreter.system_executable ) self._context = None
def __init__(self, options, interpreter): super(Venv, self).__init__(options, interpreter) self.can_be_inline = ( interpreter is CURRENT and interpreter.executable == interpreter.system_executable ) self._context = None self.builtin_way = options.builtin_way
https://github.com/pypa/virtualenv/issues/1332
$ <scl_base>/bin/virtualenv --python <scl_base>/bin/python --always-copy --verbose TEST Running virtualenv with interpreter <scl_base>/bin/python Using base prefix '<scl_base>' Creating <somedir>/TEST/lib/python3.6 Copying to <somedir>/TEST/lib64 Symlinking Python bootstrap modules Copying to <somedir>/TEST/lib/python3...
ModuleNotFoundError
def create(self): if self.can_be_inline: self.create_inline() else: self.create_via_sub_process() # TODO: cleanup activation scripts for lib in self.libs: ensure_dir(lib)
def create(self): if self.can_be_inline: self.create_inline() else: self.create_via_sub_process() # TODO: cleanup activation scripts if self.builtin_way is not None: for site_package in self.builtin_way.site_packages: ensure_dir(site_package)
https://github.com/pypa/virtualenv/issues/1332
$ <scl_base>/bin/virtualenv --python <scl_base>/bin/python --always-copy --verbose TEST Running virtualenv with interpreter <scl_base>/bin/python Using base prefix '<scl_base>' Creating <somedir>/TEST/lib/python3.6 Copying to <somedir>/TEST/lib64 Symlinking Python bootstrap modules Copying to <somedir>/TEST/lib/python3...
ModuleNotFoundError
def fixup_python2(self): """Perform operations needed to make the created environment work on Python 2""" for module in self.modules(): self.add_module(module) # 2. install a patched site-package, the default Python 2 site.py is not smart enough to understand pyvenv.cfg, # so we inject a small s...
def fixup_python2(self): """Perform operations needed to make the created environment work on Python 2""" for module in self.modules(): self.add_module(module) # 2. install a patched site-package, the default Python 2 site.py is not smart enough to understand pyvenv.cfg, # so we inject a small s...
https://github.com/pypa/virtualenv/issues/1332
$ <scl_base>/bin/virtualenv --python <scl_base>/bin/python --always-copy --verbose TEST Running virtualenv with interpreter <scl_base>/bin/python Using base prefix '<scl_base>' Creating <somedir>/TEST/lib/python3.6 Copying to <somedir>/TEST/lib64 Symlinking Python bootstrap modules Copying to <somedir>/TEST/lib/python3...
ModuleNotFoundError
def add_module(self, req): for ext in ["py", "pyc"]: file_path = "{}.{}".format(req, ext) self.copier(self.system_stdlib / file_path, self.stdlib / file_path)
def add_module(self, req): for ext in ["py", "pyc"]: file_path = "{}.{}".format(req, ext) self.copier(self.system_stdlib / file_path, self.lib_dir / file_path)
https://github.com/pypa/virtualenv/issues/1332
$ <scl_base>/bin/virtualenv --python <scl_base>/bin/python --always-copy --verbose TEST Running virtualenv with interpreter <scl_base>/bin/python Using base prefix '<scl_base>' Creating <somedir>/TEST/lib/python3.6 Copying to <somedir>/TEST/lib64 Symlinking Python bootstrap modules Copying to <somedir>/TEST/lib/python3...
ModuleNotFoundError
def add_folder(self, folder): self.copier(self.system_stdlib / folder, self.stdlib / folder)
def add_folder(self, folder): self.copier(self.system_stdlib / folder, self.lib_dir / folder)
https://github.com/pypa/virtualenv/issues/1332
$ <scl_base>/bin/virtualenv --python <scl_base>/bin/python --always-copy --verbose TEST Running virtualenv with interpreter <scl_base>/bin/python Using base prefix '<scl_base>' Creating <somedir>/TEST/lib/python3.6 Copying to <somedir>/TEST/lib64 Symlinking Python bootstrap modules Copying to <somedir>/TEST/lib/python3...
ModuleNotFoundError
def ensure_directories(self): return {self.dest_dir, self.bin_dir, self.script_dir, self.stdlib} | set(self.libs)
def ensure_directories(self): dirs = {self.dest_dir, self.bin_dir, self.lib_dir} dirs.update(self.site_packages) return dirs
https://github.com/pypa/virtualenv/issues/1332
$ <scl_base>/bin/virtualenv --python <scl_base>/bin/python --always-copy --verbose TEST Running virtualenv with interpreter <scl_base>/bin/python Using base prefix '<scl_base>' Creating <somedir>/TEST/lib/python3.6 Copying to <somedir>/TEST/lib64 Symlinking Python bootstrap modules Copying to <somedir>/TEST/lib/python3...
ModuleNotFoundError
def __init__(self): def u(v): return v.decode("utf-8") if isinstance(v, bytes) else v # qualifies the python self.platform = u(sys.platform) self.implementation = u(platform.python_implementation()) if self.implementation == "PyPy": self.pypy_version_info = tuple(u(i) for i in sys.p...
def __init__(self): # qualifies the python self.platform = sys.platform self.implementation = platform.python_implementation() self.pypy_version_info = ( tuple(sys.pypy_version_info) if self.implementation == "PyPy" else None ) # this is a tuple in earlier, struct later, unify to our ow...
https://github.com/pypa/virtualenv/issues/1332
$ <scl_base>/bin/virtualenv --python <scl_base>/bin/python --always-copy --verbose TEST Running virtualenv with interpreter <scl_base>/bin/python Using base prefix '<scl_base>' Creating <somedir>/TEST/lib/python3.6 Copying to <somedir>/TEST/lib64 Symlinking Python bootstrap modules Copying to <somedir>/TEST/lib/python3...
ModuleNotFoundError
def from_json(cls, payload): data = json.loads(payload) data["version_info"] = VersionInfo( **data["version_info"] ) # restore this to a named tuple structure result = cls() result.__dict__ = {k: v for k, v in data.items()} return result
def from_json(cls, payload): data = json.loads(payload) data["version_info"] = VersionInfo( **data["version_info"] ) # restore this to a named tuple structure result = cls() for var in vars(result): setattr(result, var, data[var]) return result
https://github.com/pypa/virtualenv/issues/1332
$ <scl_base>/bin/virtualenv --python <scl_base>/bin/python --always-copy --verbose TEST Running virtualenv with interpreter <scl_base>/bin/python Using base prefix '<scl_base>' Creating <somedir>/TEST/lib/python3.6 Copying to <somedir>/TEST/lib64 Symlinking Python bootstrap modules Copying to <somedir>/TEST/lib/python3...
ModuleNotFoundError
def _load_for_exe(cls, exe): from virtualenv.util.subprocess import subprocess, Popen cmd = cls._get_exe_cmd(exe) # noinspection DuplicatedCode # this is duplicated here because this file is executed on its own, so cannot be refactored otherwise logging.debug("get interpreter info via cmd: %s", Cmd...
def _load_for_exe(cls, exe): from virtualenv.util.subprocess import subprocess, Popen cmd = cls._get_exe_cmd(exe) # noinspection DuplicatedCode # this is duplicated here because this file is executed on its own, so cannot be refactored otherwise logging.debug("get interpreter info via cmd: %s", Cmd...
https://github.com/pypa/virtualenv/issues/1332
$ <scl_base>/bin/virtualenv --python <scl_base>/bin/python --always-copy --verbose TEST Running virtualenv with interpreter <scl_base>/bin/python Using base prefix '<scl_base>' Creating <somedir>/TEST/lib/python3.6 Copying to <somedir>/TEST/lib64 Symlinking Python bootstrap modules Copying to <somedir>/TEST/lib/python3...
ModuleNotFoundError
def __repr__(self): def e(v): return v.decode("utf-8") if isinstance(v, bytes) else v cmd_repr = e(" ").join(pipes.quote(e(c)) for c in self.cmd) if self.env is not None: cmd_repr += e(" env of {!r}").format(self.env) return cmd_repr
def __repr__(self): cmd_repr = " ".join(pipes.quote(c) for c in self.cmd) if self.env is not None: cmd_repr += " env of {!r}".format(self.env) return cmd_repr
https://github.com/pypa/virtualenv/issues/1332
$ <scl_base>/bin/virtualenv --python <scl_base>/bin/python --always-copy --verbose TEST Running virtualenv with interpreter <scl_base>/bin/python Using base prefix '<scl_base>' Creating <somedir>/TEST/lib/python3.6 Copying to <somedir>/TEST/lib64 Symlinking Python bootstrap modules Copying to <somedir>/TEST/lib/python3...
ModuleNotFoundError
def install(self): self._extracted = True # sync image for filename in self._image_dir.iterdir(): into = self._creator.purelib / filename.name logging.debug("%s %s from %s", self.__class__.__name__, into, filename) if into.exists(): if into.is_dir() and not into.is_symlin...
def install(self): self._extracted = True # sync image site_package = self._creator.site_packages[0] for filename in self._image_dir.iterdir(): into = site_package / filename.name logging.debug("%s %s from %s", self.__class__.__name__, into, filename) if into.exists(): ...
https://github.com/pypa/virtualenv/issues/1332
$ <scl_base>/bin/virtualenv --python <scl_base>/bin/python --always-copy --verbose TEST Running virtualenv with interpreter <scl_base>/bin/python Using base prefix '<scl_base>' Creating <somedir>/TEST/lib/python3.6 Copying to <somedir>/TEST/lib64 Symlinking Python bootstrap modules Copying to <somedir>/TEST/lib/python3...
ModuleNotFoundError
def _generate_new_files(self): new_files = set() installer = self._dist_info / "INSTALLER" installer.write_text("pip\n") new_files.add(installer) # inject a no-op root element, as workaround for bug added # by https://github.com/pypa/pip/commit/c7ae06c79#r35523722 marker = self._image_dir / ...
def _generate_new_files(self): new_files = set() installer = self._dist_info / "INSTALLER" installer.write_text("pip\n") new_files.add(installer) # inject a no-op root element, as workaround for bug added # by https://github.com/pypa/pip/commit/c7ae06c79#r35523722 marker = self._image_dir / ...
https://github.com/pypa/virtualenv/issues/1332
$ <scl_base>/bin/virtualenv --python <scl_base>/bin/python --always-copy --verbose TEST Running virtualenv with interpreter <scl_base>/bin/python Using base prefix '<scl_base>' Creating <somedir>/TEST/lib/python3.6 Copying to <somedir>/TEST/lib64 Symlinking Python bootstrap modules Copying to <somedir>/TEST/lib/python3...
ModuleNotFoundError
def make_exe(filename): original_mode = filename.stat().st_mode levels = [S_IXUSR, S_IXGRP, S_IXOTH] for at in range(len(levels), 0, -1): try: mode = original_mode for level in levels[:at]: mode |= level filename.chmod(mode) break ...
def make_exe(filename): original_mode = filename.stat().st_mode levels = [S_IXUSR, S_IXGRP, S_IXOTH] for at in range(len(levels), 0, -1): try: mode = original_mode for level in levels[:at]: mode |= level filename.chmod(mode) break ...
https://github.com/pypa/virtualenv/issues/1332
$ <scl_base>/bin/virtualenv --python <scl_base>/bin/python --always-copy --verbose TEST Running virtualenv with interpreter <scl_base>/bin/python Using base prefix '<scl_base>' Creating <somedir>/TEST/lib/python3.6 Copying to <somedir>/TEST/lib64 Symlinking Python bootstrap modules Copying to <somedir>/TEST/lib/python3...
ModuleNotFoundError
def symlink_or_copy(do_copy, src, dst, relative_symlinks_ok=False): """ Try symlinking a target, and if that fails, fall back to copying. """ if not src.exists(): raise RuntimeError("source {} does not exists".format(src)) if src == dst: raise RuntimeError("source {} is same as desti...
def symlink_or_copy(do_copy, src, dst, relative_symlinks_ok=False): """ Try symlinking a target, and if that fails, fall back to copying. """ def norm(val): if IS_PYPY and six.PY3: return str(val).encode(sys.getfilesystemencoding()) return six.ensure_text(str(val)) if d...
https://github.com/pypa/virtualenv/issues/1332
$ <scl_base>/bin/virtualenv --python <scl_base>/bin/python --always-copy --verbose TEST Running virtualenv with interpreter <scl_base>/bin/python Using base prefix '<scl_base>' Creating <somedir>/TEST/lib/python3.6 Copying to <somedir>/TEST/lib64 Symlinking Python bootstrap modules Copying to <somedir>/TEST/lib/python3...
ModuleNotFoundError
def _pip_config(py_executable, python_path): cmd = [py_executable, "-m", "pip", "config", "list"] config = {} for line in call_subprocess( cmd, show_stdout=False, extra_env={"PYTHONPATH": python_path, "JYTHONPATH": python_path}, remove_from_env=["PIP_VERBOSE", "PIP_QUIET"], ...
def _pip_config(py_executable, python_path): cmd = [py_executable, "-m", "pip", "config", "list"] config = {} for line in call_subprocess( cmd, show_stdout=False, extra_env={"PYTHONPATH": python_path, "JYTHONPATH": python_path}, remove_from_env=["PIP_VERBOSE", "PIP_QUIET"], ...
https://github.com/pypa/virtualenv/issues/1301
$ pip --version pip 9.0.1 from /usr/local/lib/python2.7/dist-packages (python 2.7) $ pip list | grep virtualenv virtualenv (16.3.0) $ virtualenv /tmp/venv New python executable in /tmp/venv/bin/python Complete output from command /tmp/venv/bin/python -m pip config list: ERROR: unknown command "config" ---------------...
OSError
def copy_required_modules(dst_prefix, symlink): import imp # If we are running under -p, we need to remove the current # directory from sys.path temporarily here, so that we # definitely get the modules from the site directory of # the interpreter we are running under, not the one # virtualenv....
def copy_required_modules(dst_prefix, symlink): import imp # If we are running under -p, we need to remove the current # directory from sys.path temporarily here, so that we # definitely get the modules from the site directory of # the interpreter we are running under, not the one # virtualenv....
https://github.com/pypa/virtualenv/issues/4
Traceback (most recent call last): File "virtualenv.py", line 1645, in <module> main() File "virtualenv.py", line 556, in main prompt=options.prompt) File "virtualenv.py", line 645, in create_environment site_packages=site_packages, clear=clear)) File "virtualenv.py", line 769, in install_python copy_required_modules(h...
AssertionError
def _cpp_jit( fun: F, static_argnums: Union[int, Iterable[int]] = (), device: Optional[xc.Device] = None, backend: Optional[str] = None, donate_argnums: Union[int, Iterable[int]] = (), ) -> F: """An implementation of `jit` that tries to do as much as possible in C++. The goal of this functi...
def _cpp_jit( fun: F, static_argnums: Union[int, Iterable[int]] = (), device: Optional[xc.Device] = None, backend: Optional[str] = None, donate_argnums: Union[int, Iterable[int]] = (), ) -> F: """An implementation of `jit` that tries to do as much as possible in C++. The goal of this functi...
https://github.com/google/jax/issues/5532
Traceback (most recent call last): File "tmp.py", line 11, in <module> f() # <--- fails File "tmp.py", line 4, in <lambda> f = lambda: random.uniform(random.PRNGKey(0), (10,), 'float64', -1, 1) File "/Users/vanderplas/github/google/jax/jax/_src/random.py", line 365, in uniform return _uniform(key, shape, dtype, minval...
RuntimeError
def get_jax_enable_x64(): """Returns the value of the flag after GoogleInit. We must wait until flags have been parsed (in particular for top-level functions decorated with jax.jit), so we delay inspecting the value of the jax_enable_x64 flag until JIT time. """ # TODO(jblespiau): Delete when j...
def get_jax_enable_x64(): """Returns the value of the flag after GoogleInit. We must wait until flags have been parsed (in particular for top-level functions decorated with jax.jit), so we delay inspecting the value of the jax_enable_x64 flag until JIT time. """ return config.x64_enabled
https://github.com/google/jax/issues/5532
Traceback (most recent call last): File "tmp.py", line 11, in <module> f() # <--- fails File "tmp.py", line 4, in <lambda> f = lambda: random.uniform(random.PRNGKey(0), (10,), 'float64', -1, 1) File "/Users/vanderplas/github/google/jax/jax/_src/random.py", line 365, in uniform return _uniform(key, shape, dtype, minval...
RuntimeError
def f_jitted(*args, **kwargs): # TODO(jblespiau): We can remove `config.x64_enabled` when jaxlib has # extension version 4 context = ( getattr(core.thread_local_state.trace_state.trace_stack, "dynamic", None), config.x64_enabled, ) # TODO(jblespiau): Move this to C++. if (FLAGS.j...
def f_jitted(*args, **kwargs): context = ( getattr(core.thread_local_state.trace_state.trace_stack, "dynamic", None), config.x64_enabled, ) # TODO(jblespiau): Move this to C++. if (FLAGS.jax_debug_nans or FLAGS.jax_debug_infs) and not _jit_is_disabled(): device_arrays = cpp_jitte...
https://github.com/google/jax/issues/5532
Traceback (most recent call last): File "tmp.py", line 11, in <module> f() # <--- fails File "tmp.py", line 4, in <lambda> f = lambda: random.uniform(random.PRNGKey(0), (10,), 'float64', -1, 1) File "/Users/vanderplas/github/google/jax/jax/_src/random.py", line 365, in uniform return _uniform(key, shape, dtype, minval...
RuntimeError
def x64_enabled(self): if lib._xla_extension_version >= 4: if lib.jax_jit.get_enable_x64() is None: lib.jax_jit.set_enable_x64(bool(self.read("jax_enable_x64"))) return lib.jax_jit.get_enable_x64() else: # TODO(jakevdp): Remove when minimum jaxlib is has extension version 4 ...
def x64_enabled(self): if self._thread_local_state.enable_x64 is None: self._thread_local_state.enable_x64 = bool(self.read("jax_enable_x64")) return self._thread_local_state.enable_x64
https://github.com/google/jax/issues/5532
Traceback (most recent call last): File "tmp.py", line 11, in <module> f() # <--- fails File "tmp.py", line 4, in <lambda> f = lambda: random.uniform(random.PRNGKey(0), (10,), 'float64', -1, 1) File "/Users/vanderplas/github/google/jax/jax/_src/random.py", line 365, in uniform return _uniform(key, shape, dtype, minval...
RuntimeError
def _set_x64_enabled(self, state): if lib._xla_extension_version >= 4: lib.jax_jit.set_enable_x64(bool(state)) else: # TODO(jakevdp): Remove when minimum jaxlib is has extension version 4 self._thread_local_state.enable_x64 = bool(state)
def _set_x64_enabled(self, state): self._thread_local_state.enable_x64 = bool(state)
https://github.com/google/jax/issues/5532
Traceback (most recent call last): File "tmp.py", line 11, in <module> f() # <--- fails File "tmp.py", line 4, in <lambda> f = lambda: random.uniform(random.PRNGKey(0), (10,), 'float64', -1, 1) File "/Users/vanderplas/github/google/jax/jax/_src/random.py", line 365, in uniform return _uniform(key, shape, dtype, minval...
RuntimeError
def cache(max_size=4096): def wrap(f): @functools.lru_cache(max_size) def cached(_, *args, **kwargs): return f(*args, **kwargs) @functools.wraps(f) def wrapper(*args, **kwargs): if jax.core.debug_state.check_leaks: return f(*args, **kwargs) ...
def cache(max_size=4096): def wrap(f): @functools.lru_cache(max_size) def cached(_, *args, **kwargs): return f(*args, **kwargs) @functools.wraps(f) def wrapper(*args, **kwargs): if jax.core.debug_state.check_leaks: return f(*args, **kwargs) ...
https://github.com/google/jax/issues/5532
Traceback (most recent call last): File "tmp.py", line 11, in <module> f() # <--- fails File "tmp.py", line 4, in <lambda> f = lambda: random.uniform(random.PRNGKey(0), (10,), 'float64', -1, 1) File "/Users/vanderplas/github/google/jax/jax/_src/random.py", line 365, in uniform return _uniform(key, shape, dtype, minval...
RuntimeError
def wrap(f): @functools.lru_cache(max_size) def cached(_, *args, **kwargs): return f(*args, **kwargs) @functools.wraps(f) def wrapper(*args, **kwargs): if jax.core.debug_state.check_leaks: return f(*args, **kwargs) else: return cached(bool(config.x64_enab...
def wrap(f): @functools.lru_cache(max_size) def cached(_, *args, **kwargs): return f(*args, **kwargs) @functools.wraps(f) def wrapper(*args, **kwargs): if jax.core.debug_state.check_leaks: return f(*args, **kwargs) else: return cached(bool(FLAGS.jax_enabl...
https://github.com/google/jax/issues/5532
Traceback (most recent call last): File "tmp.py", line 11, in <module> f() # <--- fails File "tmp.py", line 4, in <lambda> f = lambda: random.uniform(random.PRNGKey(0), (10,), 'float64', -1, 1) File "/Users/vanderplas/github/google/jax/jax/_src/random.py", line 365, in uniform return _uniform(key, shape, dtype, minval...
RuntimeError
def wrapper(*args, **kwargs): if jax.core.debug_state.check_leaks: return f(*args, **kwargs) else: return cached(bool(config.x64_enabled), *args, **kwargs)
def wrapper(*args, **kwargs): if jax.core.debug_state.check_leaks: return f(*args, **kwargs) else: return cached(bool(FLAGS.jax_enable_x64), *args, **kwargs)
https://github.com/google/jax/issues/5532
Traceback (most recent call last): File "tmp.py", line 11, in <module> f() # <--- fails File "tmp.py", line 4, in <lambda> f = lambda: random.uniform(random.PRNGKey(0), (10,), 'float64', -1, 1) File "/Users/vanderplas/github/google/jax/jax/_src/random.py", line 365, in uniform return _uniform(key, shape, dtype, minval...
RuntimeError
def memoize(f): @functools.lru_cache(None) def memoized(_, *args, **kwargs): return f(*args, **kwargs) @functools.wraps(f) def wrapper(*args, **kwargs): return memoized(bool(config.x64_enabled), *args, **kwargs) wrapper.cache_clear = memoized.cache_clear wrapper.cache_info = me...
def memoize(f): @functools.lru_cache(None) def memoized(_, *args, **kwargs): return f(*args, **kwargs) @functools.wraps(f) def wrapper(*args, **kwargs): return memoized(bool(FLAGS.jax_enable_x64), *args, **kwargs) wrapper.cache_clear = memoized.cache_clear wrapper.cache_info = ...
https://github.com/google/jax/issues/5532
Traceback (most recent call last): File "tmp.py", line 11, in <module> f() # <--- fails File "tmp.py", line 4, in <lambda> f = lambda: random.uniform(random.PRNGKey(0), (10,), 'float64', -1, 1) File "/Users/vanderplas/github/google/jax/jax/_src/random.py", line 365, in uniform return _uniform(key, shape, dtype, minval...
RuntimeError
def wrapper(*args, **kwargs): return memoized(bool(config.x64_enabled), *args, **kwargs)
def wrapper(*args, **kwargs): return memoized(bool(FLAGS.jax_enable_x64), *args, **kwargs)
https://github.com/google/jax/issues/5532
Traceback (most recent call last): File "tmp.py", line 11, in <module> f() # <--- fails File "tmp.py", line 4, in <lambda> f = lambda: random.uniform(random.PRNGKey(0), (10,), 'float64', -1, 1) File "/Users/vanderplas/github/google/jax/jax/_src/random.py", line 365, in uniform return _uniform(key, shape, dtype, minval...
RuntimeError
def _cpp_jit( fun: F, static_argnums: Union[int, Iterable[int]] = (), device: Optional[xc.Device] = None, backend: Optional[str] = None, donate_argnums: Union[int, Iterable[int]] = (), ) -> F: """An implementation of `jit` that tries to do as much as possible in C++. The goal of this functi...
def _cpp_jit( fun: F, static_argnums: Union[int, Iterable[int]] = (), device: Optional[xc.Device] = None, backend: Optional[str] = None, donate_argnums: Union[int, Iterable[int]] = (), ) -> F: """An implementation of `jit` that tries to do as much as possible in C++. The goal of this functi...
https://github.com/google/jax/issues/5532
Traceback (most recent call last): File "tmp.py", line 11, in <module> f() # <--- fails File "tmp.py", line 4, in <lambda> f = lambda: random.uniform(random.PRNGKey(0), (10,), 'float64', -1, 1) File "/Users/vanderplas/github/google/jax/jax/_src/random.py", line 365, in uniform return _uniform(key, shape, dtype, minval...
RuntimeError
def get_jax_enable_x64(): """Returns the value of the flag after GoogleInit. We must wait until flags have been parsed (in particular for top-level functions decorated with jax.jit), so we delay inspecting the value of the jax_enable_x64 flag until JIT time. """ return config.x64_enabled
def get_jax_enable_x64(): """Returns the value of the flag after GoogleInit. We must wait until flags have been parsed (in particular for top-level functions decorated with jax.jit), so we delay inspecting the value of the jax_enable_x64 flag until JIT time. """ return FLAGS.jax_enable_x64
https://github.com/google/jax/issues/5532
Traceback (most recent call last): File "tmp.py", line 11, in <module> f() # <--- fails File "tmp.py", line 4, in <lambda> f = lambda: random.uniform(random.PRNGKey(0), (10,), 'float64', -1, 1) File "/Users/vanderplas/github/google/jax/jax/_src/random.py", line 365, in uniform return _uniform(key, shape, dtype, minval...
RuntimeError
def f_jitted(*args, **kwargs): context = ( getattr(core.thread_local_state.trace_state.trace_stack, "dynamic", None), config.x64_enabled, ) # TODO(jblespiau): Move this to C++. if (FLAGS.jax_debug_nans or FLAGS.jax_debug_infs) and not _jit_is_disabled(): device_arrays = cpp_jitte...
def f_jitted(*args, **kwargs): context = ( getattr(core.thread_local_state.trace_state.trace_stack, "dynamic", None), bool(FLAGS.jax_enable_x64), ) # TODO(jblespiau): Move this to C++. if (FLAGS.jax_debug_nans or FLAGS.jax_debug_infs) and not _jit_is_disabled(): device_arrays = c...
https://github.com/google/jax/issues/5532
Traceback (most recent call last): File "tmp.py", line 11, in <module> f() # <--- fails File "tmp.py", line 4, in <lambda> f = lambda: random.uniform(random.PRNGKey(0), (10,), 'float64', -1, 1) File "/Users/vanderplas/github/google/jax/jax/_src/random.py", line 365, in uniform return _uniform(key, shape, dtype, minval...
RuntimeError
def canonicalize_dtype(dtype): """Convert from a dtype to a canonical dtype based on config.x64_enabled.""" if isinstance(dtype, str) and dtype == "bfloat16": dtype = bfloat16 try: dtype = np.dtype(dtype) except TypeError as e: raise TypeError(f"dtype {dtype!r} not understood") f...
def canonicalize_dtype(dtype): """Convert from a dtype to a canonical dtype based on FLAGS.jax_enable_x64.""" if isinstance(dtype, str) and dtype == "bfloat16": dtype = bfloat16 try: dtype = np.dtype(dtype) except TypeError as e: raise TypeError(f"dtype {dtype!r} not understood")...
https://github.com/google/jax/issues/5532
Traceback (most recent call last): File "tmp.py", line 11, in <module> f() # <--- fails File "tmp.py", line 4, in <lambda> f = lambda: random.uniform(random.PRNGKey(0), (10,), 'float64', -1, 1) File "/Users/vanderplas/github/google/jax/jax/_src/random.py", line 365, in uniform return _uniform(key, shape, dtype, minval...
RuntimeError
def enable_x64(): """Experimental context manager to temporarily enable X64 mode. Usage:: >>> import jax.numpy as jnp >>> with enable_x64(): ... print(jnp.arange(10.0).dtype) ... float64 See Also -------- jax.experimental.disable_x64 : temporarily disable X64 mode...
def enable_x64(): """Experimental context manager to temporarily enable X64 mode. Usage:: >>> import jax.numpy as jnp >>> with enable_x64(): ... print(jnp.arange(10.0).dtype) ... float64 See Also -------- jax.experimental.disable_x64 : temporarily disable X64 mode...
https://github.com/google/jax/issues/5532
Traceback (most recent call last): File "tmp.py", line 11, in <module> f() # <--- fails File "tmp.py", line 4, in <lambda> f = lambda: random.uniform(random.PRNGKey(0), (10,), 'float64', -1, 1) File "/Users/vanderplas/github/google/jax/jax/_src/random.py", line 365, in uniform return _uniform(key, shape, dtype, minval...
RuntimeError
def disable_x64(): """Experimental context manager to temporarily disable X64 mode. Usage:: >>> import jax.numpy as jnp >>> with disable_x64(): ... print(jnp.arange(10.0).dtype) ... float32 See Also -------- jax.experimental.enable_x64 : temporarily enable X64 mode...
def disable_x64(): """Experimental context manager to temporarily disable X64 mode. Usage:: >>> import jax.numpy as jnp >>> with disable_x64(): ... print(jnp.arange(10.0).dtype) ... float32 See Also -------- jax.experimental.enable_x64 : temporarily enable X64 mode...
https://github.com/google/jax/issues/5532
Traceback (most recent call last): File "tmp.py", line 11, in <module> f() # <--- fails File "tmp.py", line 4, in <lambda> f = lambda: random.uniform(random.PRNGKey(0), (10,), 'float64', -1, 1) File "/Users/vanderplas/github/google/jax/jax/_src/random.py", line 365, in uniform return _uniform(key, shape, dtype, minval...
RuntimeError
def dtype_to_etype(dtype): """Convert from dtype to canonical etype (reading config.x64_enabled).""" return xla_client.dtype_to_etype(dtypes.canonicalize_dtype(dtype))
def dtype_to_etype(dtype): """Convert from dtype to canonical etype (reading FLAGS.jax_enable_x64).""" return xla_client.dtype_to_etype(dtypes.canonicalize_dtype(dtype))
https://github.com/google/jax/issues/5532
Traceback (most recent call last): File "tmp.py", line 11, in <module> f() # <--- fails File "tmp.py", line 4, in <lambda> f = lambda: random.uniform(random.PRNGKey(0), (10,), 'float64', -1, 1) File "/Users/vanderplas/github/google/jax/jax/_src/random.py", line 365, in uniform return _uniform(key, shape, dtype, minval...
RuntimeError
def cache(call: Callable): """Memoization decorator for functions taking a WrappedFun as first argument. Args: call: a Python callable that takes a WrappedFun as its first argument. The underlying transforms and params on the WrappedFun are used as part of the memoization cache key. ...
def cache(call: Callable): """Memoization decorator for functions taking a WrappedFun as first argument. Args: call: a Python callable that takes a WrappedFun as its first argument. The underlying transforms and params on the WrappedFun are used as part of the memoization cache key. ...
https://github.com/google/jax/issues/5532
Traceback (most recent call last): File "tmp.py", line 11, in <module> f() # <--- fails File "tmp.py", line 4, in <lambda> f = lambda: random.uniform(random.PRNGKey(0), (10,), 'float64', -1, 1) File "/Users/vanderplas/github/google/jax/jax/_src/random.py", line 365, in uniform return _uniform(key, shape, dtype, minval...
RuntimeError
def memoized_fun(fun: WrappedFun, *args): cache = fun_caches.setdefault(fun.f, {}) if core.debug_state.check_leaks: key = (_copy_main_traces(fun.transforms), fun.params, args, config.x64_enabled) else: key = (fun.transforms, fun.params, args, config.x64_enabled) result = cache.get(key, N...
def memoized_fun(fun: WrappedFun, *args): cache = fun_caches.setdefault(fun.f, {}) if core.debug_state.check_leaks: key = ( _copy_main_traces(fun.transforms), fun.params, args, bool(FLAGS.jax_enable_x64), ) else: key = (fun.transforms, ...
https://github.com/google/jax/issues/5532
Traceback (most recent call last): File "tmp.py", line 11, in <module> f() # <--- fails File "tmp.py", line 4, in <lambda> f = lambda: random.uniform(random.PRNGKey(0), (10,), 'float64', -1, 1) File "/Users/vanderplas/github/google/jax/jax/_src/random.py", line 365, in uniform return _uniform(key, shape, dtype, minval...
RuntimeError
def minimize( fun: Callable, x0: jnp.ndarray, args: Tuple = (), *, method: str, tol: Optional[float] = None, options: Optional[Mapping[str, Any]] = None, ) -> OptimizeResults: """Minimization of scalar function of one or more variables. This API for this function matches SciPy with ...
def minimize( fun: Callable, x0: jnp.ndarray, args: Tuple = (), *, method: str, tol: Optional[float] = None, options: Optional[Mapping[str, Any]] = None, ) -> OptimizeResults: """Minimization of scalar function of one or more variables. This API for this function matches SciPy with ...
https://github.com/google/jax/issues/5732
WARNING:absl:No GPU/TPU found, falling back to CPU. (Set TF_CPP_MIN_LOG_LEVEL=0 and rerun for more info.) testing nll = [5.0628967 5.4723964] Traceback (most recent call last): File "test.py", line 37, in <module> sopt.minimize(NLL, jnp.zeros((3, 2)), Y, method="BFGS") File "/Users/nicholas/opt/miniconda3/lib/python3....
ValueError
def eval_shape(fun: Callable, *args, **kwargs): """Compute the shape/dtype of ``fun`` without any FLOPs. This utility function is useful for performing shape inference. Its input/output behavior is defined by:: def eval_shape(fun, *args, **kwargs): out = fun(*args, **kwargs) return j...
def eval_shape(fun: Callable, *args, **kwargs): """Compute the shape/dtype of ``fun`` without any FLOPs. This utility function is useful for performing shape inference. Its input/output behavior is defined by:: def eval_shape(fun, *args, **kwargs): out = fun(*args, **kwargs) return j...
https://github.com/google/jax/issues/5683
import objax import jax m = objax.nn.Sequential([objax.nn.Linear(3, 4)]) v = objax.random.uniform(((32, 3))) jax.eval_shape(m, v) # ShapeDtypeStruct(shape=(32, 4), dtype=float32) d = objax.util.EasyDict(shape=(32, 3), dtype=v.dtype) print(repr(d.shape), repr(d.dtype)) # (32, 3) dtype('float32') print(hasattr(d, 'sha...
TypeError
def abstractify(x): return ShapedArray(np.shape(x), dtype(x))
def abstractify(x): return ShapedArray(np.shape(x), dtypes.result_type(x))
https://github.com/google/jax/issues/5683
import objax import jax m = objax.nn.Sequential([objax.nn.Linear(3, 4)]) v = objax.random.uniform(((32, 3))) jax.eval_shape(m, v) # ShapeDtypeStruct(shape=(32, 4), dtype=float32) d = objax.util.EasyDict(shape=(32, 3), dtype=v.dtype) print(repr(d.shape), repr(d.dtype)) # (32, 3) dtype('float32') print(hasattr(d, 'sha...
TypeError
def _result_type_raw(*args): if len(args) == 1: return _jax_type(args[0]) return _least_upper_bound(*{_jax_type(arg) for arg in args})
def _result_type_raw(*args): if len(args) < 2: return _jax_type(args[0]) return _least_upper_bound(*{_jax_type(arg) for arg in args})
https://github.com/google/jax/issues/5683
import objax import jax m = objax.nn.Sequential([objax.nn.Linear(3, 4)]) v = objax.random.uniform(((32, 3))) jax.eval_shape(m, v) # ShapeDtypeStruct(shape=(32, 4), dtype=float32) d = objax.util.EasyDict(shape=(32, 3), dtype=v.dtype) print(repr(d.shape), repr(d.dtype)) # (32, 3) dtype('float32') print(hasattr(d, 'sha...
TypeError
def result_type(*args): """Convenience function to apply Numpy argument dtype promotion.""" if len(args) == 0: raise ValueError("at least one array or dtype is required") return canonicalize_dtype(_result_type_raw(*args))
def result_type(*args): """Convenience function to apply Numpy argument dtype promotion.""" return canonicalize_dtype(_result_type_raw(*args))
https://github.com/google/jax/issues/5683
import objax import jax m = objax.nn.Sequential([objax.nn.Linear(3, 4)]) v = objax.random.uniform(((32, 3))) jax.eval_shape(m, v) # ShapeDtypeStruct(shape=(32, 4), dtype=float32) d = objax.util.EasyDict(shape=(32, 3), dtype=v.dtype) print(repr(d.shape), repr(d.dtype)) # (32, 3) dtype('float32') print(hasattr(d, 'sha...
TypeError
def id_tap(tap_func, arg, *, result=None, tap_with_device=False, **kwargs): """Host-callback tap primitive, like identity function with a call to ``tap_func``. **Experimental: please give feedback, and expect changes!** ``id_tap`` behaves semantically like the identity function but has the side-effect...
def id_tap(tap_func, arg, *, result=None, tap_with_device=False, **kwargs): """Host-callback tap primitive, like identity function with a call to ``tap_func``. **Experimental: please give feedback, and expect changes!** ``id_tap`` behaves semantically like the identity function but has the side-effect...
https://github.com/google/jax/issues/5414
Traceback (most recent call last): File "/home/neil/src/a.py", line 13, in <module> print(scan(f, None, None, 10)) File "/home/neil/src/jax/jax/_src/lax/control_flow.py", line 1266, in scan init_flat, carry_avals, carry_avals_out, init_tree, *rest = _create_jaxpr(init) File "/home/neil/src/jax/jax/_src/lax/control_flow...
AssertionError
def dynamic_slice_in_dim(operand, start_index, slice_size, axis=0): """Convenience wrapper around dynamic_slice applying to one dimension.""" start_indices = [onp.array([0], dtype=_dtype(start_index))] * operand.ndim slice_sizes = list(operand.shape) axis = int(axis) axis_size = _const(start_index,...
def dynamic_slice_in_dim(operand, start_index, slice_size, axis=0): """Convenience wrapper around dynamic_slice applying to one dimension.""" start_indices = [onp.array([0])] * operand.ndim slice_sizes = list(operand.shape) axis = int(axis) axis_size = _const(start_index, operand.shape[axis]) s...
https://github.com/google/jax/issues/826
(1, 2, 2) (3, 2) [[1. 1.] [1. 1.] [1. 1.]] /Users/skainswo/.local/share/virtualenvs/research-OGGq2tNy/lib/python3.7/site-packages/jax/lib/xla_bridge.py:130: UserWarning: No GPU/TPU found, falling back to CPU. warnings.warn('No GPU/TPU found, falling back to CPU.') -------------------------------------------------------...
ValueError
def lu_pivots_to_permutation(swaps, m): """Converts the pivots (row swaps) returned by LU to a permutation. We build a permutation rather than applying `swaps` directly to the rows of a matrix because lax loops aren't differentiable. Args: swaps: an array of shape (..., k) of row swaps to perfor...
def lu_pivots_to_permutation(swaps, k): """Converts the pivots (row swaps) returned by LU to a permutation.""" def body_fn(i, loop_carry): swaps, permutation = loop_carry j = swaps[i] x, y = np.ravel(permutation[i]), np.ravel(permutation[j]) permutation = lax.dynamic_update_inde...
https://github.com/google/jax/issues/826
(1, 2, 2) (3, 2) [[1. 1.] [1. 1.] [1. 1.]] /Users/skainswo/.local/share/virtualenvs/research-OGGq2tNy/lib/python3.7/site-packages/jax/lib/xla_bridge.py:130: UserWarning: No GPU/TPU found, falling back to CPU. warnings.warn('No GPU/TPU found, falling back to CPU.') -------------------------------------------------------...
ValueError
def body_fn(i, permutation): j = swaps[..., i] iotas = np.ix_(*(lax.iota(np.int32, b) for b in batch_dims)) x = permutation[..., i] y = permutation[iotas + (j,)] permutation = ops.index_update(permutation, ops.index[..., i], y) return ops.index_update(permutation, ops.index[iotas + (j,)], x)
def body_fn(i, loop_carry): swaps, permutation = loop_carry j = swaps[i] x, y = np.ravel(permutation[i]), np.ravel(permutation[j]) permutation = lax.dynamic_update_index_in_dim(permutation, y, i, axis=0) permutation = lax.dynamic_update_index_in_dim(permutation, x, j, axis=0) return swaps, permu...
https://github.com/google/jax/issues/826
(1, 2, 2) (3, 2) [[1. 1.] [1. 1.] [1. 1.]] /Users/skainswo/.local/share/virtualenvs/research-OGGq2tNy/lib/python3.7/site-packages/jax/lib/xla_bridge.py:130: UserWarning: No GPU/TPU found, falling back to CPU. warnings.warn('No GPU/TPU found, falling back to CPU.') -------------------------------------------------------...
ValueError
def solve(a, b): a, b = _promote_arg_dtypes(np.asarray(a), np.asarray(b)) a_shape = np.shape(a) b_shape = np.shape(b) a_ndims = len(a_shape) b_ndims = len(b_shape) if not (a_ndims >= 2 and a_shape[-1] == a_shape[-2] and b_ndims >= 1): msg = ( "The arguments to solve must have...
def solve(a, b): a, b = _promote_arg_dtypes(np.asarray(a), np.asarray(b)) a_shape = np.shape(a) b_shape = np.shape(b) a_ndims = len(a_shape) b_ndims = len(b_shape) if not ( a_ndims >= 2 and a_shape[-1] == a_shape[-2] and (a_ndims == b_ndims or a_ndims == b_ndims + 1) ...
https://github.com/google/jax/issues/826
(1, 2, 2) (3, 2) [[1. 1.] [1. 1.] [1. 1.]] /Users/skainswo/.local/share/virtualenvs/research-OGGq2tNy/lib/python3.7/site-packages/jax/lib/xla_bridge.py:130: UserWarning: No GPU/TPU found, falling back to CPU. warnings.warn('No GPU/TPU found, falling back to CPU.') -------------------------------------------------------...
ValueError
def _solve(a, b): _check_solve_shapes(a, b) # Broadcast leading dimensions of b to the shape of a, as is required by # custom_linear_solve. out_shape = tuple( d_a if d_b == 1 else d_b for d_a, d_b in zip(a.shape[:-1] + (1,), b.shape) ) b = jnp.broadcast_to(b, out_shape) # With cust...
def _solve(a, b): _check_solve_shapes(a, b) # With custom_linear_solve, we can reuse the same factorization when # computing sensitivities. This is considerably faster. lu_, _, permutation = lu(lax.stop_gradient(a)) custom_solve = partial( lax.custom_linear_solve, lambda x: _matvec_...
https://github.com/google/jax/issues/826
(1, 2, 2) (3, 2) [[1. 1.] [1. 1.] [1. 1.]] /Users/skainswo/.local/share/virtualenvs/research-OGGq2tNy/lib/python3.7/site-packages/jax/lib/xla_bridge.py:130: UserWarning: No GPU/TPU found, falling back to CPU. warnings.warn('No GPU/TPU found, falling back to CPU.') -------------------------------------------------------...
ValueError
def _check_solve_shapes(a, b): if not ( a.ndim >= 2 and b.ndim in [a.ndim, a.ndim - 1] and a.shape[-1] == a.shape[-2] == b.shape[a.ndim - 2] ): raise ValueError( "The arguments to solve must have shapes a=[..., m, m] and " f"b=[..., m, k] or b=[..., m]; go...
def _check_solve_shapes(a, b): if not (a.ndim >= 2 and a.shape[-1] == a.shape[-2] and b.ndim >= 1): msg = ( "The arguments to solve must have shapes a=[..., m, m] and " "b=[..., m, k] or b=[..., m]; got a={} and b={}" ) raise ValueError(msg.format(a.shape, b.shape))
https://github.com/google/jax/issues/5313
--------------------------------------------------------------------------- FilteredStackTrace Traceback (most recent call last) <ipython-input-1-551ceea3fd37> in <module> 2 ----> 3 jax.numpy.linalg.inv(jax.numpy.zeros((0, 0))) /opt/texat-venv/lib/python3.8/site-packages/jax/_src/numpy/linalg.py...
ZeroDivisionError
def _lu_solve_core(lu, permutation, b, trans): m = lu.shape[0] x = jnp.reshape(b, (m, np.prod(b.shape[1:]))) if trans == 0: x = x[permutation, :] x = triangular_solve(lu, x, left_side=True, lower=True, unit_diagonal=True) x = triangular_solve(lu, x, left_side=True, lower=False) e...
def _lu_solve_core(lu, permutation, b, trans): m = lu.shape[0] x = jnp.reshape(b, (m, -1)) if trans == 0: x = x[permutation, :] x = triangular_solve(lu, x, left_side=True, lower=True, unit_diagonal=True) x = triangular_solve(lu, x, left_side=True, lower=False) elif trans == 1 or ...
https://github.com/google/jax/issues/5313
--------------------------------------------------------------------------- FilteredStackTrace Traceback (most recent call last) <ipython-input-1-551ceea3fd37> in <module> 2 ----> 3 jax.numpy.linalg.inv(jax.numpy.zeros((0, 0))) /opt/texat-venv/lib/python3.8/site-packages/jax/_src/numpy/linalg.py...
ZeroDivisionError
def inv(a): if jnp.ndim(a) < 2 or a.shape[-1] != a.shape[-2]: raise ValueError(f"Argument to inv must have shape [..., n, n], got {a.shape}.") return solve( a, lax.broadcast(jnp.eye(a.shape[-1], dtype=lax.dtype(a)), a.shape[:-2]) )
def inv(a): if jnp.ndim(a) < 2 or a.shape[-1] != a.shape[-2]: raise ValueError( "Argument to inv must have shape [..., n, n], got {}.".format(jnp.shape(a)) ) return solve( a, lax.broadcast(jnp.eye(a.shape[-1], dtype=lax.dtype(a)), a.shape[:-2]) )
https://github.com/google/jax/issues/5313
--------------------------------------------------------------------------- FilteredStackTrace Traceback (most recent call last) <ipython-input-1-551ceea3fd37> in <module> 2 ----> 3 jax.numpy.linalg.inv(jax.numpy.zeros((0, 0))) /opt/texat-venv/lib/python3.8/site-packages/jax/_src/numpy/linalg.py...
ZeroDivisionError
def _cpp_jit( fun: F, static_argnums: Union[int, Iterable[int]] = (), device: Optional[xc.Device] = None, backend: Optional[str] = None, donate_argnums: Union[int, Iterable[int]] = (), ) -> F: """An implementation of `jit` that tries to do as much as possible in C++. The goal of this functi...
def _cpp_jit( fun: F, static_argnums: Union[int, Iterable[int]] = (), device: Optional[xc.Device] = None, backend: Optional[str] = None, donate_argnums: Union[int, Iterable[int]] = (), ) -> F: """An implementation of `jit` that tries to do as much as possible in C++. The goal of this functi...
https://github.com/google/jax/issues/5190
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-42-f8e638fc2bb6> in <module> ----> 1 _get_pairwise_frequencies(data) <ipython-input-30-43adeb39c76c> in _get_pairwise_frequencies(data, crosstab) 25 ...
ValueError
def cache_miss(_, *args, **kwargs): ### This first part is basically the same code as in _python_jit. # An alternative would be for cache_miss to accept from C++ the arguments # (dyn_args, donated_invars, args_flat, in_tree), since otherwise we have # work/code that is redundant between C++ and Python. ...
def cache_miss(_, *args, **kwargs): ### This first part is basically the same code as in _python_jit. # An alternative would be for cache_miss to accept from C++ the arguments # (dyn_args, donated_invars, args_flat, in_tree), since otherwise we have # work/code that is redundant between C++ and Python. ...
https://github.com/google/jax/issues/5190
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-42-f8e638fc2bb6> in <module> ----> 1 _get_pairwise_frequencies(data) <ipython-input-30-43adeb39c76c> in _get_pairwise_frequencies(data, crosstab) 25 ...
ValueError
def _cpp_jit( fun: Callable, static_argnums: Union[int, Iterable[int]] = (), device=None, backend: Optional[str] = None, donate_argnums: Union[int, Iterable[int]] = (), ) -> Callable: """An implementation of `jit` that tries to do as much as possible in C++. The goal of this function is to ...
def _cpp_jit( fun: Callable, static_argnums: Union[int, Iterable[int]] = (), device=None, backend: Optional[str] = None, donate_argnums: Union[int, Iterable[int]] = (), ) -> Callable: """An implementation of `jit` that tries to do as much as possible in C++. The goal of this function is to ...
https://github.com/google/jax/issues/5190
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-42-f8e638fc2bb6> in <module> ----> 1 _get_pairwise_frequencies(data) <ipython-input-30-43adeb39c76c> in _get_pairwise_frequencies(data, crosstab) 25 ...
ValueError
def cache_miss(*args, **kwargs): ### This first part is basically the same code as in _python_jit. # An alternative would be for cache_miss to accept from C++ the arguments # (dyn_args, donated_invars, args_flat, in_tree), since otherwise we have # work/code that is redundant between C++ and Python. We ...
def cache_miss(*args, **kwargs): ### This first part is basically the same code as in _python_jit. # An alternative would be for cache_miss to accept from C++ the arguments # (dyn_args, donated_invars, args_flat, in_tree), since otherwise we have # work/code that is redundant between C++ and Python. We ...
https://github.com/google/jax/issues/5190
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-42-f8e638fc2bb6> in <module> ----> 1 _get_pairwise_frequencies(data) <ipython-input-30-43adeb39c76c> in _get_pairwise_frequencies(data, crosstab) 25 ...
ValueError
def reduce( operands: Array, init_values: Array, computation: Callable, dimensions: Sequence[int], ) -> Array: """Wraps XLA's `Reduce <https://www.tensorflow.org/xla/operation_semantics#reduce>`_ operator. """ flat_operands, operand_tree = tree_util.tree_flatten(operands) flat_in...
def reduce( operands: Array, init_values: Array, computation: Callable, dimensions: Sequence[int], ) -> Array: """Wraps XLA's `Reduce <https://www.tensorflow.org/xla/operation_semantics#reduce>`_ operator. """ flat_operands, operand_tree = tree_util.tree_flatten(operands) flat_in...
https://github.com/google/jax/issues/4672
--------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) <ipython-input-88-7216fb989347> in <module>() 4 5 with jax.disable_jit(): ----> 6 jnp.repeat(jnp.zeros((1, 2)), repeats=2, axis=0, total_repeat_length=2) 7 8 def run_...
RuntimeError
def primitive_computation(prim, axis_env, backend, tuple_args, *avals, **params): c = xb.make_computation_builder(f"primitive_computation_{prim.name}") c.set_op_metadata( xc.OpMetadata(op_type=prim.name, op_name=str(pp_eqn_compact(prim.name, params))) ) platform = xb.get_backend(backend).platfor...
def primitive_computation(prim, axis_env, backend, tuple_args, *avals, **params): c = xb.make_computation_builder(f"primitive_computation_{prim.name}") c.set_op_metadata( xc.OpMetadata(op_type=prim.name, op_name=str(pp_eqn_compact(prim.name, params))) ) platform = xb.get_backend(backend).platfor...
https://github.com/google/jax/issues/4672
--------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) <ipython-input-88-7216fb989347> in <module>() 4 5 with jax.disable_jit(): ----> 6 jnp.repeat(jnp.zeros((1, 2)), repeats=2, axis=0, total_repeat_length=2) 7 8 def run_...
RuntimeError
def _lift_linearized(jaxpr, primal_avals, consts, io_tree, out_pvals, *py_args): def fun(*tangents): tangent_avals = list(map(core.get_aval, tangents)) for primal_aval, tangent_aval in zip(primal_avals, tangent_avals): try: core.lattice_join(primal_aval.at_least_vspace(),...
def _lift_linearized(jaxpr, primal_avals, consts, io_tree, out_pvals, *py_args): def fun(*tangents): tangent_avals = list(map(core.get_aval, tangents)) for primal_aval, tangent_aval in zip(primal_avals, tangent_avals): try: core.lattice_join(primal_aval, tangent_aval) ...
https://github.com/google/jax/issues/4622
/usr/local/lib/python3.6/dist-packages/jax/lib/xla_bridge.py:130: UserWarning: No GPU/TPU found, falling back to CPU. warnings.warn('No GPU/TPU found, falling back to CPU.') --------------------------------------------------------------------------- ConcretizationTypeError Traceback (most recent call ...
ConcretizationTypeError
def fun(*tangents): tangent_avals = list(map(core.get_aval, tangents)) for primal_aval, tangent_aval in zip(primal_avals, tangent_avals): try: core.lattice_join(primal_aval.at_least_vspace(), tangent_aval) except TypeError as e: msg = ( "linearized functio...
def fun(*tangents): tangent_avals = list(map(core.get_aval, tangents)) for primal_aval, tangent_aval in zip(primal_avals, tangent_avals): try: core.lattice_join(primal_aval, tangent_aval) except TypeError as e: msg = ( "linearized function called on tangen...
https://github.com/google/jax/issues/4622
/usr/local/lib/python3.6/dist-packages/jax/lib/xla_bridge.py:130: UserWarning: No GPU/TPU found, falling back to CPU. warnings.warn('No GPU/TPU found, falling back to CPU.') --------------------------------------------------------------------------- ConcretizationTypeError Traceback (most recent call ...
ConcretizationTypeError
def __eq__(self, other): if ( type(self) is type(other) and self.dtype == other.dtype and self.shape == other.shape and self.weak_type == other.weak_type ): with eval_context(): # in case self.val is a DeviceArray return (self.val == other.val).all() else...
def __eq__(self, other): return ( type(self) is type(other) and self.dtype == other.dtype and self.shape == other.shape and self.weak_type == other.weak_type and np.all(self.val == other.val) )
https://github.com/google/jax/issues/4622
/usr/local/lib/python3.6/dist-packages/jax/lib/xla_bridge.py:130: UserWarning: No GPU/TPU found, falling back to CPU. warnings.warn('No GPU/TPU found, falling back to CPU.') --------------------------------------------------------------------------- ConcretizationTypeError Traceback (most recent call ...
ConcretizationTypeError
def _threefry2x32_gpu_translation_rule(c, k1, k2, x1, x2): shape = lax.broadcast_shapes( c.get_shape(k1).dimensions(), c.get_shape(k2).dimensions(), c.get_shape(x1).dimensions(), c.get_shape(x2).dimensions(), ) rank = len(shape) if 0 in shape: zeros = xla_client.o...
def _threefry2x32_gpu_translation_rule(c, k1, k2, x1, x2): shape = lax.broadcast_shapes( c.get_shape(k1).dimensions(), c.get_shape(k2).dimensions(), c.get_shape(x1).dimensions(), c.get_shape(x2).dimensions(), ) rank = len(shape) def _broadcast(x): ndims = c.get_s...
https://github.com/google/jax/issues/4565
--------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) <ipython-input-2-1d1849d1c41c> in <module>() 5 jax.random.uniform(key, shape) # ok 6 with jax.disable_jit(): ----> 7 jax.random.uniform(key, shape) # CUDA operati...
RuntimeError
def _is_sorted(dims, op_name, name): for i in range(1, len(dims)): if dims[i] < dims[i - 1]: raise TypeError(f"{name} in {op_name} op must be sorted; got {dims}")
def _is_sorted(dims, name): for i in range(1, len(dims)): if dims[i] < dims[i - 1]: raise TypeError(f"{name} in scatter op must be sorted; got {dims}")
https://github.com/google/jax/issues/3905
LayerError Traceback (most recent call last) <ipython-input-91-cc4d1abeffd2> in <module> ----> 1 embed_out = embed(x) /opt/conda/lib/python3.7/site-packages/trax/layers/base.py in __call__(self, x, weights, state, rng) 165 self.state = state # Needed if the model wasn't fully init...
LayerError
def _sorted_dims_in_range(dims, rank, op_name, name): if len(dims) == 0: return invalid_dim = None if dims[0] < 0: invalid_dim = dims[0] elif dims[-1] >= rank: invalid_dim = dims[-1] if invalid_dim: raise TypeError( f"Invalid {name} set in {op_name} op; va...
def _sorted_dims_in_range(dims, rank, name): if len(dims) == 0: return invalid_dim = None if dims[0] < 0: invalid_dim = dims[0] elif dims[-1] >= rank: invalid_dim = dims[-1] if invalid_dim: raise TypeError( f"Invalid {name} set in scatter op; valid range i...
https://github.com/google/jax/issues/3905
LayerError Traceback (most recent call last) <ipython-input-91-cc4d1abeffd2> in <module> ----> 1 embed_out = embed(x) /opt/conda/lib/python3.7/site-packages/trax/layers/base.py in __call__(self, x, weights, state, rng) 165 self.state = state # Needed if the model wasn't fully init...
LayerError
def _no_duplicate_dims(dims, op_name, name): if len(set(dims)) != len(dims): raise TypeError(f"{name} in {op_name} op must not repeat; got: {dims}.")
def _no_duplicate_dims(dims, name): if len(set(dims)) != len(dims): raise TypeError(f"{name} in scatter op must not repeat; got: {dims}.")
https://github.com/google/jax/issues/3905
LayerError Traceback (most recent call last) <ipython-input-91-cc4d1abeffd2> in <module> ----> 1 embed_out = embed(x) /opt/conda/lib/python3.7/site-packages/trax/layers/base.py in __call__(self, x, weights, state, rng) 165 self.state = state # Needed if the model wasn't fully init...
LayerError
def _gather_shape_rule(operand, start_indices, *, dimension_numbers, slice_sizes): """Validates the well-formedness of the arguments to Gather. The code implements the checks based on the detailed operation semantics of XLA's `Gather <https://www.tensorflow.org/xla/operation_semantics#gather>`_ operato...
def _gather_shape_rule(operand, start_indices, *, dimension_numbers, slice_sizes): if len(operand.shape) != len(slice_sizes): msg = ( "slice_sizes must have rank equal to the gather operand; " "operand.shape={}, slice_sizes={}".format(operand.shape, slice_sizes) ) rai...
https://github.com/google/jax/issues/3905
LayerError Traceback (most recent call last) <ipython-input-91-cc4d1abeffd2> in <module> ----> 1 embed_out = embed(x) /opt/conda/lib/python3.7/site-packages/trax/layers/base.py in __call__(self, x, weights, state, rng) 165 self.state = state # Needed if the model wasn't fully init...
LayerError
def _scatter_shape_rule( operand, scatter_indices, updates, *, update_jaxpr, update_consts, dimension_numbers, indices_are_sorted, unique_indices, ): """Validates the well-formedness of the ``dimension_numbers`` argument to Scatter. The code implements the checks based o...
def _scatter_shape_rule( operand, scatter_indices, updates, *, update_jaxpr, update_consts, dimension_numbers, indices_are_sorted, unique_indices, ): """Validates the well-formedness of the ``dimension_numbers`` argument to Scatter. The code implements the checks based o...
https://github.com/google/jax/issues/3905
LayerError Traceback (most recent call last) <ipython-input-91-cc4d1abeffd2> in <module> ----> 1 embed_out = embed(x) /opt/conda/lib/python3.7/site-packages/trax/layers/base.py in __call__(self, x, weights, state, rng) 165 self.state = state # Needed if the model wasn't fully init...
LayerError
def choice(key, a, shape=(), replace=True, p=None): """Generates a random sample from a given 1-D array. Args: key: a PRNGKey used as the random key. a : 1D array or int. If an ndarray, a random sample is generated from its elements. If an int, the random sample is generated as if a were ...
def choice(key, a, shape=(), replace=True, p=None): """Generates a random sample from a given 1-D array. Args: key: a PRNGKey used as the random key. a : 1D array or int. If an ndarray, a random sample is generated from its elements. If an int, the random sample is generated as if a were ...
https://github.com/google/jax/issues/4124
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-19-56696338bc13> in <module>() 1 key = jax.random.PRNGKey(0) 2 jax.random.choice(key, 5, 2, replace=False) ----> 3 jax.random.choice(key, 5, 2, replace=T...
TypeError
def _rewrite_eqn( eqn: core.JaxprEqn, eqns: List[core.JaxprEqn], input_token_var: core.Var, output_token_var: core.Var, mk_new_var: Callable[[core.AbstractValue], core.Var], ): """Rewrite an `eqn` and append equations to `eqns`. Assume that the current token is in `input_token_var` and the ...
def _rewrite_eqn( eqn: core.JaxprEqn, eqns: List[core.JaxprEqn], input_token_var: core.Var, output_token_var: core.Var, mk_new_var: Callable[[core.AbstractValue], core.Var], ): """Rewrite an `eqn` and append equations to `eqns`. Assume that the current token is in `input_token_var` and the ...
https://github.com/google/jax/issues/3863
Traceback (most recent call last): File "demos/encoding.py", line 95, in <module> encoding_demo() File "demos/encoding.py", line 80, in encoding_demo training_trajectory = problem.train() File "/home/neil/.pyenv/versions/3.8.2/lib/python3.8/site-packages/cmm/problem/problem.py", line 31, in train trajectory, self.model...
AssertionError
def _rewrite_while_outfeed_cond( eqn: core.JaxprEqn, eqns: List[core.JaxprEqn], input_token_var: core.Var, output_token_var: core.Var, mk_new_var: Callable, ): """Rewrite a while whose cond has outfeed""" cond_jaxpr, cond_nconsts, body_jaxpr, body_nconsts = util.split_dict( eqn.param...
def _rewrite_while_outfeed_cond( eqn: core.JaxprEqn, eqns: List[core.JaxprEqn], input_token_var: core.Var, output_token_var: core.Var, mk_new_var: Callable, ): """Rewrite a while whose cond has outfeed""" cond_jaxpr, cond_nconsts, body_jaxpr, body_nconsts = util.split_dict( eqn.param...
https://github.com/google/jax/issues/3863
Traceback (most recent call last): File "demos/encoding.py", line 95, in <module> encoding_demo() File "demos/encoding.py", line 80, in encoding_demo training_trajectory = problem.train() File "/home/neil/.pyenv/versions/3.8.2/lib/python3.8/site-packages/cmm/problem/problem.py", line 31, in train trajectory, self.model...
AssertionError
def population_count(x): assert np.issubdtype(x.dtype, np.integer) dtype = x.dtype iinfo = np.iinfo(x.dtype) if np.iinfo(x.dtype).bits < 32: assert iinfo.kind in ("i", "u") x = x.astype(np.uint32 if iinfo.kind == "u" else np.int32) if iinfo.kind == "i": x = x.view(f"uint{np.i...
def population_count(x): dtype = x.dtype if x.dtype in (np.uint8, np.uint16): x = x.astype(np.uint32) assert x.dtype in (np.uint32, np.uint64) m = [ 0x5555555555555555, # binary: 0101... 0x3333333333333333, # binary: 00110011.. 0x0F0F0F0F0F0F0F0F, # binary: 4 zeros, ...
https://github.com/google/jax/issues/3886
lax.population_count(np.array([True, False], dtype=np.bool_)) Traceback (most recent call last): File "/jax/jax/interpreters/xla.py", line 311, in primitive_computation return c.build() RuntimeError: Invalid argument: Expected an integral element type in argument to PopulationCount operation; got PRED.: The above exce...
RuntimeError
def _reduce_prod_jvp_rule(primals, tangents, *, axes): (operand,) = primals (tangent,) = tangents input_shape = onp.array(operand.shape) n = onp.prod(input_shape[list(axes)]) non_axes = onp.delete(onp.arange(len(input_shape)), axes) # Move the reduced axes to the front, and flatten them to 1D....
def _reduce_prod_jvp_rule(primals, tangents, *, axes): (operand,) = primals (tangent,) = tangents input_shape = onp.array(operand.shape) n = onp.prod(input_shape[list(axes)]) non_axes = onp.delete(onp.arange(len(input_shape)), axes) # Move the reduced axes to the front, and flatten them to 1D....
https://github.com/google/jax/issues/1888
--------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) /usr/local/lib/python3.6/dist-packages/jax/interpreters/xla.py in primitive_computation(prim, *avals, **params) 179 try: --> 180 return c.Build() 181 except Run...
RuntimeError
def _reduce_prod_tree(x, axis=0): """Reduce by repeatedly splitting the array and multiplying.""" while x.shape[axis] > 1: n = x.shape[axis] n1 = (n + 1) // 2 n2 = n - n1 x1 = slice_in_dim(x, 0, n1) x2 = slice_in_dim(x, n1, None) if n2 != n1: paddings ...
def _reduce_prod_tree(x, axis=0): """Reduce by repeatedly splitting the array and multiplying.""" while x.shape[axis] > 1: n = x.shape[axis] n1 = (n + 1) // 2 n2 = n - n1 x1 = slice_in_dim(x, 0, n1) x2 = slice_in_dim(x, n1, None) if n2 != n1: paddings ...
https://github.com/google/jax/issues/1888
--------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) /usr/local/lib/python3.6/dist-packages/jax/interpreters/xla.py in primitive_computation(prim, *avals, **params) 179 try: --> 180 return c.Build() 181 except Run...
RuntimeError
def broadcast_shapes(*shapes): """Returns the shape that results from NumPy broadcasting of `shapes`.""" if len(shapes) == 1: return shapes[0] ndim = _max(len(shape) for shape in shapes) shapes = onp.array([(1,) * (ndim - len(shape)) + shape for shape in shapes]) result_shape = _try_broadcas...
def broadcast_shapes(*shapes): """Returns the shape that results from NumPy broadcasting of `shapes`.""" if len(shapes) == 1: return shapes[0] ndim = _max(len(shape) for shape in shapes) shapes = onp.array([(1,) * (ndim - len(shape)) + shape for shape in shapes]) is_zero = onp.any(shapes == ...
https://github.com/google/jax/issues/3216
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-9-b3bfdb20b090> in <module>() 3 4 jax.shapecheck(["(m,n)", "n"], "(m,n)")(jnp.add) # passes ----> 5 jax.shapecheck(["n", "(m,n)"], "(m,n)")(jnp.add) # ...
ValueError
def _broadcasting_shape_rule(name, *avals): shapes = onp.array([aval.shape for aval in avals if aval.shape]) if not shapes.size: return () if len({len(shape) for shape in shapes}) != 1: msg = "{} got arrays of different rank: {}." raise TypeError(msg.format(name, ", ".join(map(str, m...
def _broadcasting_shape_rule(name, *avals): shapes = onp.array([aval.shape for aval in avals if aval.shape]) if not shapes.size: return () if len({len(shape) for shape in shapes}) != 1: msg = "{} got arrays of different rank: {}." raise TypeError(msg.format(name, ", ".join(map(str, m...
https://github.com/google/jax/issues/3216
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-9-b3bfdb20b090> in <module>() 3 4 jax.shapecheck(["(m,n)", "n"], "(m,n)")(jnp.add) # passes ----> 5 jax.shapecheck(["n", "(m,n)"], "(m,n)")(jnp.add) # ...
ValueError
def _while_loop_translation_rule( c, axis_env, name_stack, avals, backend, *args, cond_jaxpr, body_jaxpr, cond_nconsts, body_nconsts, ): cond_consts, body_consts, init_vals = split_list(args, [cond_nconsts, body_nconsts]) batched = bool(cond_jaxpr.out_avals[0].shape) ...
def _while_loop_translation_rule( c, axis_env, name_stack, avals, backend, *args, cond_jaxpr, body_jaxpr, cond_nconsts, body_nconsts, ): cond_consts, body_consts, init_vals = split_list(args, [cond_nconsts, body_nconsts]) batched = bool(cond_jaxpr.out_avals[0].shape) ...
https://github.com/google/jax/issues/3204
Traceback (most recent call last): File "test.py", line 21, in <module> print(vmap_test(arr, arr)) File "/home/adabbott/Git/jax/jax/jax/api.py", line 858, in batched_fun lambda: flatten_axes(out_tree(), out_axes)) File "/home/adabbott/Git/jax/jax/jax/interpreters/batching.py", line 34, in batch return batched_fun.call_...
AssertionError
def _pred_bcast_select(c, pred, x, y, x_y_aval: core.AbstractValue): pred_shape = c.get_shape(pred).dimensions() x_shape = c.get_shape(x).dimensions() y_shape = c.get_shape(y).dimensions() assert x_shape == y_shape if x_y_aval is core.abstract_unit: return x elif x_y_aval is core.abstrac...
def _pred_bcast_select(c, pred, x, y): pred_shape = c.get_shape(pred).dimensions() x_shape = c.get_shape(x).dimensions() y_shape = c.get_shape(y).dimensions() assert x_shape == y_shape if not c.get_shape(x).is_array() and not c.get_shape(y).is_array(): # Two tokens return xops.AfterA...
https://github.com/google/jax/issues/3204
Traceback (most recent call last): File "test.py", line 21, in <module> print(vmap_test(arr, arr)) File "/home/adabbott/Git/jax/jax/jax/api.py", line 858, in batched_fun lambda: flatten_axes(out_tree(), out_axes)) File "/home/adabbott/Git/jax/jax/jax/interpreters/batching.py", line 34, in batch return batched_fun.call_...
AssertionError
def psum(x, axis_name, *, axis_index_groups=None): """Compute an all-reduce sum on ``x`` over the pmapped axis ``axis_name``. If ``x`` is a pytree then the result is equivalent to mapping this function to each leaf in the tree. Inputs of boolean dtype are converted to integers before the reduction. ...
def psum(x, axis_name, *, axis_index_groups=None): """Compute an all-reduce sum on ``x`` over the pmapped axis ``axis_name``. If ``x`` is a pytree then the result is equivalent to mapping this function to each leaf in the tree. Args: x: array(s) with a mapped axis named ``axis_name``. axis...
https://github.com/google/jax/issues/3123
Traceback (most recent call last): File "[REDACTED]/py/jax/interpreters/xla.py", line 301, in primitive_computation return c.build() RuntimeError: Invalid argument: Expected element type in shape to be arithmetic type for operation add; got PRED.: @ 0x55b73da20345 xla::XlaBuilder::BinaryOp() @ 0x55b73da19d...
RuntimeError
def _sort_translation_rule(c, *operands, dimension): types = [c.get_shape(x).xla_element_type() for x in operands] subc = xla_bridge.make_computation_builder("sort_lt_comparator") params = [ xb.parameter(subc, 2 * i + j, xc.Shape.array_shape(typ, ())) for i, typ in enumerate(types) f...
def _sort_translation_rule(c, *operands, dimension): out = xops.Sort(c, operands, dimension=dimension, is_stable=True) return out if len(operands) != 1 else xops.Tuple(c, [out])
https://github.com/google/jax/issues/3074
❯ pipenv run python -m research.lqr /Users/skainswo/dev/jax/jax/lib/xla_bridge.py:116: UserWarning: No GPU/TPU found, falling back to CPU. warnings.warn('No GPU/TPU found, falling back to CPU.') Traceback (most recent call last): File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python...
RuntimeError
def _quantile(a, q, axis, interpolation, keepdims): a = asarray(a, dtype=promote_types(_dtype(a), float_)) q = asarray(q, dtype=promote_types(_dtype(q), float_)) if axis is None: a = ravel(a) axis = 0 elif isinstance(axis, tuple): raise NotImplementedError("Tuple values for axis ...
def _quantile(a, q, axis, interpolation, keepdims): a = asarray(a) if axis is None: a = ravel(a) axis = 0 elif isinstance(axis, tuple): raise NotImplementedError("Tuple values for axis are not implemented") else: axis = _canonicalize_axis(axis, ndim(a)) q_ndim = ndim...
https://github.com/google/jax/issues/3070
TypeError Traceback (most recent call last) <ipython-input-28-eb17bd577cca> in <module> ----> 1 np.median(np.array([i for i in range(0,10)])) /opt/anaconda3/lib/python3.7/site-packages/jax/numpy/lax_numpy.py in median(a, axis, out, overwrite_input, keepdims) 3556 q = 0.5 3557 re...
TypeError
def mask(fun: Callable, in_shapes, out_shape) -> Callable: _check_callable(fun) in_specs, in_shapes_tree = tree_flatten(in_shapes) out_specs, out_shapes_tree = tree_flatten(out_shape) in_specs = map(masking.parse_spec, in_specs) out_specs = map(masking.parse_spec, out_specs) unique_ids: Dict[A...
def mask(fun: Callable, in_shapes, out_shape) -> Callable: _check_callable(fun) in_specs, in_shapes_tree = tree_flatten(in_shapes) out_specs, out_shapes_tree = tree_flatten(out_shape) in_specs = map(masking.parse_spec, in_specs) out_specs = map(masking.parse_spec, out_specs) unique_ids: Dict[A...
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def wrapped_fun(args, logical_env): args_flat, in_tree = tree_flatten(args) if in_tree != in_shapes_tree: raise TypeError("pytree mismatch") logical_env = {unique_ids[name]: val for name, val in logical_env.items()} in_shapes = map(masking.finalize_spec, in_specs, map(onp.shape, args_flat)) ...
def wrapped_fun(args, logical_env): args_flat, in_tree = tree_flatten(args) if in_tree != in_shapes_tree: raise TypeError("pytree mismatch") logical_env = {unique_ids[name]: val for name, val in logical_env.items()} in_shapes = map(masking.finalize_spec, in_specs, map(onp.shape, args_flat)) ...
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def _remap_ids(names, shape_spec): return masking.ShapeSpec( Poly( { Mon({names[id]: deg for id, deg in mon.items()}): coeff for mon, coeff in poly.items() } ) if poly is not masking._monomorphic_dim else masking._monomorphic_di...
def _remap_ids(names, shape_spec): ShapeSpec, Poly, Mon = masking.ShapeSpec, masking.Poly, masking.Mon mdim = masking.monomorphic_dim return ShapeSpec( Poly( { Mon({names[id]: deg for id, deg in mon.items()}): coeff for mon, coeff in poly.items() ...
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def _bind_shapes(shape_exprs, shapes): env = {} for shape_expr, shape in zip(shape_exprs, shapes): for poly, d in zip(shape_expr, shape): if type(poly) is not Poly or poly.is_constant: continue else: ((binder,),) = poly # TODO generalize to handle...
def _bind_shapes(shape_exprs, shapes): env = {} for shape_expr, shape in zip(shape_exprs, shapes): for poly, d in zip(shape_expr, shape): if ensure_poly(poly).is_constant: continue else: ((binder,),) = poly # TODO generalize to handle striding ...
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def shapecheck(in_shapes, out_shape, fun: Callable): _check_callable(fun) in_shapes, in_tree = tree_flatten(in_shapes) in_shapes = map(masking.parse_spec, in_shapes) out_shapes, out_tree = tree_flatten(out_shape) out_shapes = map(masking.parse_spec, out_shapes) flat_fun, out_tree_ = flatten_fun_...
def shapecheck(in_shapes, out_shape, fun): _check_callable(fun) in_shapes, in_tree = tree_flatten(in_shapes) in_shapes = map(masking.parse_spec, in_shapes) out_shapes, out_tree = tree_flatten(out_shape) out_shapes = map(masking.parse_spec, out_shapes) flat_fun, out_tree_ = flatten_fun_nokwargs(l...
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def extend_shape_envs(logical_env, padded_env): global shape_envs new_logical = dict(chain(shape_envs.logical.items(), logical_env.items())) new_padded = dict(chain(shape_envs.padded.items(), padded_env.items())) shape_envs, prev = ShapeEnvs(new_logical, new_padded), shape_envs yield shape_envs ...
def extend_shape_envs(logical_env, padded_env): global shape_envs new_logical = dict(it.chain(shape_envs.logical.items(), logical_env.items())) new_padded = dict(it.chain(shape_envs.padded.items(), padded_env.items())) shape_envs, prev = ShapeEnvs(new_logical, new_padded), shape_envs yield shape...
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def shape_as_value(shape): return eval_polymorphic_shape(shape, shape_envs.logical)
def shape_as_value(expr): if type(expr) is tuple and is_polymorphic(expr): return tuple( eval_dim_expr(shape_envs.logical, d) if type(d) is Poly else d for d in expr ) else: return expr
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def padded_shape_as_value(shape): return eval_polymorphic_shape(shape, shape_envs.padded)
def padded_shape_as_value(expr): if type(expr) is tuple and is_polymorphic(expr): return tuple( eval_dim_expr(shape_envs.padded, d) if type(d) is Poly else d for d in expr ) else: return expr
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def __init__(self, coeffs): # Makes sure Polynomials are always in canonical form coeffs = {mon: op.index(coeff) for mon, coeff in coeffs.items() if coeff != 0} coeffs = coeffs or {Mon(): 0} super().__init__(coeffs)
def __init__(self, coeffs): # Makes sure Polynomials are always in canonical form to simplify operators: coeffs = {mon: coeff for mon, coeff in coeffs.items() if coeff != 0} coeffs = {Mon(): 0} if len(coeffs) == 0 else coeffs super().__init__(coeffs)
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def __add__(self, other): coeffs = self.copy() for mon, coeff in _ensure_poly(other).items(): coeffs[mon] = coeffs.get(mon, 0) + coeff return Poly(coeffs)
def __add__(self, other): coeffs = self.copy() for mon, coeff in ensure_poly(other).items(): coeffs[mon] = coeffs.get(mon, 0) + coeff return Poly(coeffs)
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def __mul__(self, other): other = _ensure_poly(other) coeffs = {} for (mon1, coeff1), (mon2, coeff2) in product(self.items(), other.items()): mon = mon1 * mon2 coeffs[mon] = coeffs.get(mon, 0) + coeff1 * coeff2 return Poly(coeffs)
def __mul__(self, other): coeffs = dict() for (mon1, coeff1), (mon2, coeff2) in it.product( self.items(), ensure_poly(other).items() ): mon = Mon(mon1 + mon2) # add monomials' id degrees coeff = coeff1 * coeff2 # multiply integer coeffs coeffs[mon] = coeffs.get(mon, 0) + co...
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def __rmul__(self, other): return self * other # multiplication commutes
def __rmul__(self, other): return self * other
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError
def __radd__(self, other): return self + other # addition commutes
def __radd__(self, other): return self + other
https://github.com/google/jax/issues/2245
Traceback (most recent call last): File "/Users/necula/Source/jax/jax/interpreters/xla.py", line 230, in primitive_computation return c.Build() File "/Users/necula/Source/jax/jax/lib/xla_bridge.py", line 281, in Build *args, **kwargs) File "/Users/necula/Source/jax/build/jaxlib/xla_client.py", line 734, in Build return...
RuntimeError