Skip to content

collect_env

torch_to_nnef.collect_env

Used to collect environment status/versions for debuging purpose.

check_release_file

check_release_file()

Read /etc/*-release file to get a pretty name for linux distros.

dump_environment_versions

dump_environment_versions(pathdir: Path, tract_path: Path)

Dumps software versions to a file 'versions' in the given folder.

get_gcc_version

get_gcc_version()

Returns the GCC version string, or None if gcc is not found.

get_hostname

get_hostname()

Returns the system hostname.

get_lsb_version

get_lsb_version()

Returns lsb_release Description output like 'Ubuntu 20.04.6 LTS'.

get_mac_version

get_mac_version()

Returns macOS version like '10.14.6'.

get_os

get_os() -> str

Returns a pretty string describing the OS.

get_pip_packages

get_pip_packages()

Returns pip list output.

Note: will also find conda-installed pytorch and numpy packages.

get_platform

get_platform() -> str

Returns a simplified platform name.

get_uname

get_uname() -> str

Returns the output of uname -a.

get_user

get_user()

OS current user name, or empty string if it cannot be determined.

get_windows_version

get_windows_version()

Returns Windows version like 'Microsoft Windows 10 Pro'.

python_version

python_version() -> str

Returns a one-liner with python version and bitness.

run_and_parse_first_match

run_and_parse_first_match(command, regex)

Runs command, returns the first regex match if it exists.

run_and_read_all

run_and_read_all(command)

Runs command; reads and returns entire output if rc is 0.

run_lambda

run_lambda(command)

Returns (return-code, stdout, stderr).

And Strips trailing newlines.