Skip to main content

A handy library inspired by kaldi/egs/wsj/utils

Project description

This packages is inspired by Kaldi's utils from wsj recipe.

utils_v3.get_stats

Recursively "walks" into data object and gives brief stats. e.g:

    >>> import numpy as np
    >>> import json
    >>> import utils_v3

    >>> data = [
        {'array_01':np.random.rand(3,4)},
        {'array_02':np.random.rand(3,1)}
    ]

    >>> stats = utils_v3.get_stats(data, 'data')

    >>> print(json.dumps(stats, indent=4))
    {
        "var_name": "data",
        "size": "0.078125 KB",
        "type": "<class 'list'>",
        "len": "2",
        "1st item": {
            "var_name": "data[0]",
            "size": "0.234375 KB",
            "type": "<class 'dict'>",
            "key_count": "1",
            "1st item": {
                "var_name": "data[0][array_01]",
                "size": "0.203125 KB",
                "type": "<class 'numpy.ndarray'>",
                "shape": "(3, 4)",
                "dtype": "float64"
            }
        }
    }

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyutils_v3-0.1.tar.gz (2.0 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page