def get_tkd_value(tensor_keyed_dict, tensor, allclose_kwargs=None):
    """
    Helper function to find a value in a tensor-keyed-
    dictionary using an approximation to the key.  This
    is useful if rounding errors in construction occur
    or hashing issues arise in tensor-keyed-dictionaries
    (e. g. from symmetry_reduce).  Resolves most
    hashing issues, and is preferable to redefining
    eq methods in the base tensor class.

    Args:
        tensor_keyed_dict (dict): dict with Tensor keys
        tensor (Tensor): tensor to find value of in the dict
        allclose_kwargs (dict): dict of keyword-args
            to pass to allclose.
    """
    if allclose_kwargs is None:
        allclose_kwargs = {}
    for tkey, value in tensor_keyed_dict.items():
        if np.allclose(tensor, tkey, **allclose_kwargs):
            return value
def get_tkd_value ( tensor_keyed_dict , tensor , allclose_kwargs = None ) : if allclose_kwargs is None : allclose_kwargs = { } for tkey , value in tensor_keyed_dict . items ( ) : if np . allclose ( tensor , tkey , ** allclose_kwargs ) : return value
Helper function to find a value in a tensor-keyed-
    dictionary using an approximation to the key.  This
    is useful if rounding errors in construction occur
    or hashing issues arise in tensor-keyed-dictionaries
    (e. g. from symmetry_reduce).  Resolves most
    hashing issues, and is preferable to redefining
    eq methods in the base tensor class.

    Args:
        tensor_keyed_dict (dict): dict with Tensor keys
        tensor (Tensor): tensor to find value of in the dict
        allclose_kwargs (dict): dict of keyword-args
            to pass to allclose.