Skip to content
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

C API 2.0 Tensor and TensorList #5799

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

mzient
Copy link
Contributor

@mzient mzient commented Jan 31, 2025

Category:

New feature (non-breaking change which adds functionality)

Description:

This PR adds wrappers for Tensor and TensorList that are later used to implement the C interface for those objects.

Additional information:

Affected modules and functionalities:

Key points relevant for the review:

Tests:

  • Existing tests apply
  • New tests added
    • Python tests
    • GTests
    • Benchmark
    • Other
  • N/A

Checklist

Documentation

  • Existing documentation applies
  • Documentation updated
    • Docstring
    • Doxygen
    • RST
    • Jupyter
    • Other
  • N/A

DALI team only

Requirements

  • Implements new requirements
  • Affects existing requirements
  • N/A

REQ IDs: N/A

JIRA TASK: N/A

Copy link
Collaborator

@szkarpinski szkarpinski left a comment

Choose a reason for hiding this comment

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

Leaving some initial comments

// Interfaces
//////////////////////////////////////////////////////////////////////////////

class ITensor : public _DALITensor, public RefCountedObject {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we use this ISomething convention in the code elsewhere?

Comment on lines +352 to +356
tl_->Reset();
tl_->SetSize(num_samples);
tl_->set_sample_dim(ndim);
tl_->SetLayout(new_layout);
tl_->set_type(dtype);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why sometimes it's like_that and sometimes LikeThat?

Validate(dtype);

for (int i = 0; i < num_samples; i++) {
if (ndim && !samples[i].shape)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: ndim > 0?

@@ -0,0 +1,414 @@
// Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are you testing non-contiguous tensor lists here?

Signed-off-by: Michał Zientkiewicz <[email protected]>
Signed-off-by: Michał Zientkiewicz <[email protected]>
Signed-off-by: Michał Zientkiewicz <[email protected]>
Signed-off-by: Michał Zientkiewicz <[email protected]>
@mzient mzient force-pushed the C_API2_data_objects branch from e27aa11 to 361bf44 Compare February 10, 2025 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants