-
Notifications
You must be signed in to change notification settings - Fork 1
Reduce the diff with the pytrch:main branch #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: paddle
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,12 +10,12 @@ | |
| #include <string> | ||
| #include "c10/core/SymIntArrayRef.h" | ||
| #include "c10/util/Exception.h" | ||
| #include "torch/library.h" | ||
| #include "src/torchcodec/_core/AVIOFileLikeContext.h" | ||
| #include "src/torchcodec/_core/AVIOTensorContext.h" | ||
| #include "src/torchcodec/_core/Encoder.h" | ||
| #include "src/torchcodec/_core/SingleStreamDecoder.h" | ||
| #include "src/torchcodec/_core/ValidationUtils.h" | ||
| #include "torch/library.h" | ||
|
|
||
| namespace facebook::torchcodec { | ||
|
|
||
|
|
@@ -118,7 +118,7 @@ OpsFrameOutput makeOpsFrameOutput(FrameOutput& frame) { | |
| // frame.data, | ||
| // torch::tensor(frame.ptsSeconds, torch::dtype(torch::kFloat64)), | ||
| // torch::tensor(frame.durationSeconds, torch::dtype(torch::kFloat64))); | ||
| return std::make_tuple( | ||
| return std::make_tuple( | ||
| frame.data, | ||
| torch::full({}, frame.ptsSeconds, torch::kFloat64), | ||
| torch::full({}, frame.durationSeconds, torch::kFloat64)); | ||
|
|
@@ -920,15 +920,15 @@ void scan_all_streams_to_update_metadata(at::Tensor& decoder) { | |
| videoDecoder->scanFileAndUpdateMetadataAndIndex(); | ||
| } | ||
|
|
||
| TORCH_LIBRARY_IMPL(torchcodec_ns, CPU, m) { | ||
| TORCH_LIBRARY_IMPL(torchcodec_ns, BackendSelect, m) { | ||
| m.impl("create_from_file", &create_from_file); | ||
| m.impl("create_from_tensor", &create_from_tensor); | ||
| m.impl("_create_from_file_like", &_create_from_file_like); | ||
|
Comment on lines
+923
to
926
|
||
| m.impl( | ||
| "_get_json_ffmpeg_library_versions", &_get_json_ffmpeg_library_versions); | ||
| // } | ||
| } | ||
|
|
||
| // TORCH_LIBRARY_IMPL(torchcodec_ns, CPU, m) { | ||
| TORCH_LIBRARY_IMPL(torchcodec_ns, CPU, m) { | ||
| m.impl("encode_audio_to_file", &encode_audio_to_file); | ||
| m.impl("encode_audio_to_tensor", &encode_audio_to_tensor); | ||
| m.impl("_encode_audio_to_file_like", &_encode_audio_to_file_like); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swr_convert()can return a negative value on error. Passing that directly as thelengthtolastSamples.narrow(...)will throw an unrelated/cryptic error (or potentially create an invalid slice). Add an explicit check foractualNumRemainingSamples < 0and surface a clear failure (e.g.,TORCH_CHECK(actualNumRemainingSamples >= 0, ...)) before narrowing; optionally also handle the== 0case explicitly.