def slice_np_buckets(np_buckets, slice_dict):
    """
    Takes slices of the tensors in Numpy buckets
    over the variables in idx_parallel.

    Parameters
    ----------
    np_buckets : list of lists
              Buckets containing Numpy tensors
    slice_dict : dict
              Current subtensor along the sliced variables
              in the form {variable: slice}
    Returns
    -------
    sliced_buckets : list of lists
              buckets with sliced tensors
    """
    # import pdb
    # pdb.set_trace()

    # Create tf buckets from unordered buckets
    sliced_buckets = []
    for bucket in np_buckets:
        sliced_bucket = []
        for tensor in bucket:
            slice_bounds = []
            for idx in tensor.indices:
                try:
                    slice_bounds.append(slice_dict[idx])
                except KeyError:
                    slice_bounds.append(slice(None))
            sliced_bucket.append(
                tensor.copy(data=tensor.data[tuple(slice_bounds)])
            )
        sliced_buckets.append(sliced_bucket)

    return sliced_buckets