Skip to content

Conversation

pglagol
Copy link

@pglagol pglagol commented Aug 18, 2025

Summary

  • Fix tensor indexing in Unity inference to use correct CHW layout
  • Fixed erroneous behavior of the agent on the Unity side when there is more than one visual channel

Problem

The indexing formula was calculating HWC layout while Unity's visual sensors write data in CHW format.

Solution

Corrected TensorExtensions.Index() to properly calculate CHW tensor indices that match Unity's observation writer
format.

This change corrects the tensor indexing calculation in TensorExtensions.Index()
to properly support CHW (channels-height-width) format used by both Unity's
observation writers and ONNX models during inference.
Copy link

@robinDLFM robinDLFM left a comment

Choose a reason for hiding this comment

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

Solved it for me

@maryamziaa maryamziaa self-requested a review August 22, 2025 17:11
Copy link
Contributor

@maryamziaa maryamziaa left a comment

Choose a reason for hiding this comment

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

Hi, thank you for submitting the PR. I'll take a look after Release 4

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.

3 participants