Skip to content

Stable tensor maybe#1242

Draft
NicolasHug wants to merge 17 commits intometa-pytorch:mainfrom
NicolasHug:stable_tensor_maybe
Draft

Stable tensor maybe#1242
NicolasHug wants to merge 17 commits intometa-pytorch:mainfrom
NicolasHug:stable_tensor_maybe

Conversation

@NicolasHug
Copy link
Contributor

No description provided.

@pytorch-bot
Copy link

pytorch-bot bot commented Feb 13, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/meta-pytorch/torchcodec/1242

Note: Links to docs will display an error until the docs builds have been completed.

❌ 28 New Failures

As of commit f55a9a1 with merge base cc15044 (image):

NEW FAILURES - The following jobs have failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Feb 13, 2026
{INITIAL_TENSOR_SIZE},
kStableUInt8,
kStableStrided,
StableDevice(kStableCPU)),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: rely on defaults?

Comment on lines +65 to +66
// We double the size of the outpout tensor. Calling stableCat() may not be
// the most efficient, but it's simple.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO

// For Decoding: enables users to pass in the entire video or audio as bytes.
// Our read and seek functions then traverse the bytes in memory.
class AVIOFromTensorContext : public AVIOContextHolder {
class TORCHCODEC_API AVIOFromTensorContext : public AVIOContextHolder {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: why is TORCHCODEC_API needed?

torch::stable::copy_(
preAllocatedOutputTensor.value(),
frameOutput.data,
/*non_blocking=*/std::nullopt);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO rely on default?

Comment on lines +504 to +505
kStableStrided,
StableDevice(kStableCPU));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO rely on default?

// AVFrame::data requires uint8_t* (non-const). We use const_data_ptr and
// const_cast since FFmpeg's sws_scale treats the source as const internally.
uint8_t* tensorData =
const_cast<uint8_t*>(static_cast<const uint8_t*>(frame.const_data_ptr()));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO understand this


#include <fmt/format.h>
#include <pybind11/pybind11.h>
#include <torch/types.h>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO review entire file

UniqueAVFrame avFrameToDelete(it->second);
g_avframe_map.erase(it);
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO hmmmmmmm

// Returns an optional tensor containing the flushed samples, or std::nullopt
// if there are no buffered samples or audio is not supported.
virtual std::optional<torch::Tensor> maybeFlushAudioBuffers() {
virtual std::optional<StableTensor> maybeFlushAudioBuffers() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO review everything below this file.


// ============================================================================
// Tensor types
// ============================================================================
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider removing most aliases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant