Skip to content

Conversation

@paveltc
Copy link
Contributor

@paveltc paveltc commented Dec 8, 2025

Motivation

Adds the C++ and Python implementations of the ConvertTo operator that converts the data type of an input tensor to a different data type for the output tensor.

Technical Details

The ConvertTo operator is used for converting a tensor from one data type to another. Works for all data types except unsigned int32.

Test Plan

The PR also includes the C-Model against which the host and device kernels are checked. Includes tests for 1, 3 and 4 channels for various different data types. Also has the Python Pytest test which does tests on all permutations of data types and channels.

Test Result

All C++ and Python tests pass.

Submission Checklist

@codecov-commenter
Copy link

codecov-commenter commented Dec 9, 2025

Codecov Report

❌ Patch coverage is 76.08696% with 22 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/op_convert_to.cpp 77.22% 2 Missing and 16 partials ⚠️
include/kernels/host/convert_to_host.hpp 75.00% 0 Missing and 3 partials ⚠️
include/core/detail/casting.hpp 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             develop     #104   +/-   ##
==========================================
  Coverage           ?   73.72%           
==========================================
  Files              ?       72           
  Lines              ?     2793           
  Branches           ?      608           
==========================================
  Hits               ?     2059           
  Misses             ?      327           
  Partials           ?      407           
Files with missing lines Coverage Δ
include/core/image_format.hpp 0.00% <ø> (ø)
include/core/detail/casting.hpp 75.95% <0.00%> (ø)
include/kernels/host/convert_to_host.hpp 75.00% <75.00%> (ø)
src/op_convert_to.cpp 77.22% <77.22%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants