2a1bd4c93a998d16516d82893401b346d66a95e9,imgaug/dtypes.py,,get_minimal_dtype,#Any#Any#,58

Before Change


    promoted_dt = np.promote_types(*input_dts)
    if increase_itemsize_factor > 1:
        promoted_dt_highres = "%s%d" % (promoted_dt.kind, promoted_dt.itemsize * increase_itemsize_factor)
        try:
            promoted_dt_highres = np.dtype(promoted_dt_highres)
            return promoted_dt_highres
        except TypeError:
            raise TypeError(
                ("Unable to create a numpy dtype matching the name "%s". "
                 + "This error was caused when trying to find a minimal dtype covering the dtypes "%s" (which was "
                 + "determined to be "%s") and then increasing its resolution (aka itemsize) by a factor of %d. "
                 + "This error can be avoided by choosing arrays with lower resolution dtypes as inputs, e.g. by "
                 + "reducing float32 to float16.") % (
                    promoted_dt_highres,
                    ", ".join([input_dt.name for input_dt in input_dts]),
                    promoted_dt.name,
                    increase_itemsize_factor
                )
            )
    return promoted_dt


def get_minimal_dtype_for_values(values, allowed_kinds, default, allow_bool_as_intlike=True):

After Change




def get_minimal_dtype(arrays, increase_itemsize_factor=1):
    assert isinstance(arrays, list), (
        "Expected a list of arrays or dtypes, got type %s." % (type(arrays),))
    assert len(arrays) > 0, (
        "Cannot estimate minimal dtype of an empty iterable.")

    input_dts = normalize_dtypes(arrays)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: aleju/imgaug
Commit Name: 2a1bd4c93a998d16516d82893401b346d66a95e9
Time: 2019-07-19
Author: kontakt@ajung.name
File Name: imgaug/dtypes.py
Class Name:
Method Name: get_minimal_dtype


Project Name: ray-project/ray
Commit Name: 8cf598deab3158239e96ae193d1e42315ecb007e
Time: 2020-04-27
Author: nflu@users.noreply.github.com
File Name: python/ray/util/sgd/torch/distributed_torch_runner.py
Class Name: LocalDistributedRunner
Method Name: __init__


Project Name: tensorpack/tensorpack
Commit Name: 07e28eea3cb0e3d9f1eec7aeee0f2f0630411d57
Time: 2020-07-15
Author: ppwwyyxxc@gmail.com
File Name: tensorpack/utils/gpu.py
Class Name:
Method Name: get_num_gpu