def _sync_docs_for_sample(
        cls, collection_name, sample_id, frame_numbers, hard=False
    ):
        """Syncs the backing documents for all in-memory frames attached to the
        specified sample according to the following rules:

        -   Frames whose frame numbers are in ``frame_numbers`` are reloaded
        -   Frames whose frame numbers are not in ``frame_numbers`` are reset
        """
        if collection_name not in cls._instances:
            return

        samples = cls._instances[collection_name]
        frames = samples.get(str(sample_id), {})

        if not frames:
            return

        if callable(frame_numbers):
            frame_numbers = frame_numbers()

        frame_numbers = set(frame_numbers)
        reset_fns = set()

        for frame_number, frame in frames.items():
            if frame_number in frame_numbers:
                frame.reload(hard=hard)
            else:
                reset_fns.add(frame_number)
                frame._reset_backing_doc()

        for frame_number in reset_fns:
            frames.pop(frame_number)
Syncs the backing documents for all in-memory frames attached to the
        specified sample according to the following rules:

        -   Frames whose frame numbers are in ``frame_numbers`` are reloaded
        -   Frames whose frame numbers are not in ``frame_numbers`` are reset
        
fiftyone/core/singletons.py