Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/torchcodec/decoders/_audio_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from pathlib import Path
from typing import Optional, Union

import torch
from torch import Tensor

from torchcodec import _core as core, AudioSamples
Expand Down Expand Up @@ -59,6 +60,7 @@ def __init__(
sample_rate: Optional[int] = None,
num_channels: Optional[int] = None,
):
torch._C._log_api_usage_once("torchcodec.decoders.AudioDecoder")
self._decoder = create_decoder(source=source, seek_mode="approximate")

core.add_audio_stream(
Expand Down
2 changes: 2 additions & 0 deletions src/torchcodec/decoders/_video_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from pathlib import Path
from typing import Literal, Optional, Tuple, Union

import torch
from torch import device as torch_device, Tensor

from torchcodec import _core as core, Frame, FrameBatch
Expand Down Expand Up @@ -80,6 +81,7 @@ def __init__(
device: Optional[Union[str, torch_device]] = "cpu",
seek_mode: Literal["exact", "approximate"] = "exact",
):
torch._C._log_api_usage_once("torchcodec.decoders.VideoDecoder")
allowed_seek_modes = ("exact", "approximate")
if seek_mode not in allowed_seek_modes:
raise ValueError(
Expand Down
1 change: 1 addition & 0 deletions src/torchcodec/encoders/_audio_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class AudioEncoder:
"""

def __init__(self, samples: Tensor, *, sample_rate: int):
torch._C._log_api_usage_once("torchcodec.encoders.AudioEncoder")
# Some of these checks are also done in C++: it's OK, they're cheap, and
# doing them here allows to surface them when the AudioEncoder is
# instantiated, rather than later when the encoding methods are called.
Expand Down
2 changes: 2 additions & 0 deletions src/torchcodec/samplers/_index_based.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ def clips_at_random_indices(
policy: Literal["repeat_last", "wrap", "error"] = "repeat_last",
) -> FrameBatch:
# See docstring below
torch._C._log_api_usage_once("torchcodec.samplers.clips_at_random_indices")
return _generic_index_based_sampler(
kind="random",
decoder=decoder,
Expand All @@ -219,6 +220,7 @@ def clips_at_regular_indices(
policy: Literal["repeat_last", "wrap", "error"] = "repeat_last",
) -> FrameBatch:
# See docstring below
torch._C._log_api_usage_once("torchcodec.samplers.clips_at_regular_indices")
return _generic_index_based_sampler(
kind="regular",
decoder=decoder,
Expand Down
2 changes: 2 additions & 0 deletions src/torchcodec/samplers/_time_based.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ def clips_at_random_timestamps(
policy: Literal["repeat_last", "wrap", "error"] = "repeat_last",
) -> FrameBatch:
# See docstring below
torch._C._log_api_usage_once("torchcodec.samplers.clips_at_random_timestamps")
return _generic_time_based_sampler(
kind="random",
decoder=decoder,
Expand All @@ -256,6 +257,7 @@ def clips_at_regular_timestamps(
policy: Literal["repeat_last", "wrap", "error"] = "repeat_last",
) -> FrameBatch:
# See docstring below
torch._C._log_api_usage_once("torchcodec.samplers.clips_at_regular_timestamps")
return _generic_time_based_sampler(
kind="regular",
decoder=decoder,
Expand Down
Loading