def save(self, sample):
        """Registers the sample for saving in the next batch.

        Args:
            sample: a :class:`fiftyone.core.sample.Sample` or
                :class:`fiftyone.core.sample.SampleView`
        """
        if sample._in_db and sample._dataset is not self._dataset:
            raise ValueError(
                "Dataset context '%s' cannot save sample from dataset '%s'"
                % (self._dataset.name, sample._dataset.name)
            )

        sample_ops, frame_ops = sample._save(deferred=True)
        updated = sample_ops or frame_ops

        if sample_ops:
            self._sample_ops.extend(sample_ops)

        if frame_ops:
            self._frame_ops.extend(frame_ops)

        if updated and self._is_generated:
            self._batch_ids.append(sample.id)

        if updated and isinstance(sample, fosa.SampleView):
            self._reload_parents.append(sample)

        if self._batching_strategy == "static":
            self._curr_batch_size += 1
            if self._curr_batch_size >= self.batch_size:
                self._save_batch()
                self._curr_batch_size = 0
        elif self._batching_strategy == "size":
            if sample_ops:
                self._curr_batch_size_bytes += sum(
                    len(str(op)) for op in sample_ops
                )

            if frame_ops:
                self._curr_batch_size_bytes += sum(
                    len(str(op)) for op in frame_ops
                )

            if (
                self._curr_batch_size_bytes
                >= self.batch_size * self._encoding_ratio
            ):
                self._save_batch()
                self._curr_batch_size_bytes = 0
        elif self._batching_strategy == "latency":
            if timeit.default_timer() - self._last_time >= self.batch_size:
                self._save_batch()
                self._last_time = timeit.default_timer()
Registers the sample for saving in the next batch.

        Args:
            sample: a :class:`fiftyone.core.sample.Sample` or
                :class:`fiftyone.core.sample.SampleView`
        
fiftyone/core/collections.py