def distribute_calib_tensors(calib_tensors, calib_cfg, tensor_to_node):
    """Distributes the tensors for calibration, depending on the
       algorithm set in the configuration of their nodes.

    Args:
        calib_tensors: tensors to distribute.
        calib_cfg (dict): calibration configuration.
        tensor_to_node (dict): tensor to node mapping.

    Returns:
        tuple: kl tensors and minmax tensors.
    """
    calib_tensors = set(calib_tensors)
    kl_tensors = {}
    minmax_tensors = {}
    for cl in calib_tensors:
        assert cl in tensor_to_node, '`calib_tensors` entry matched no node. Entry: {}'.format(cl)
        node = tensor_to_node[cl]
        if node in calib_cfg['calib_kl_nodes']:
            kl_tensors[cl] = node
        if node in calib_cfg['calib_minmax_nodes']:
            minmax_tensors[cl] = node

    kl_tensors = set(kl_tensors.keys())
    minmax_tensors = set(minmax_tensors.keys())
    assert len(kl_tensors & minmax_tensors) == 0, 'same `calib_tensors` entries matched both kl ' \
        'and minmax nodes. Entries: {}'.format(kl_tensors & minmax_tensors)

    rest = calib_tensors - (kl_tensors | minmax_tensors)
    assert len(rest) == 0, 'Unexpected `calib_tensors` entries. Entries: {}'.format(rest)

    return (kl_tensors, minmax_tensors)