Skip to content

Conversation

@chriselion
Copy link
Contributor

Followup from the last PR - save a TensorShape instead of the int[] in WriteAdapter to reuse the index calculation code from there

This also undoes a signature change, since we don't need the shape when passing a TensorProxy to write (since the tensor already knows its shape).

m_Offset = channelOffset;
m_Data = null;
m_Shape = shape;
m_TensorShape = m_Proxy.data.shape;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This isn't used in the tensor case, but just set it for consistency.

var index = m_Batch * height * width * channels + h * width * channels + w * channels + ch;
m_Data[index + m_Offset] = value;
var index = m_TensorShape.Index(m_Batch, h, w, ch + m_Offset);
m_Data[index] = value;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could compute the index for both TensorProxy and float array cases, and use m_Proxy.data[index] = value; but I don't see a strong reason for doing that. Same for the vector case.

Copy link
Contributor

@surfnerd surfnerd left a comment

Choose a reason for hiding this comment

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

I like the changes. Seems a bit cleaner.

@chriselion chriselion merged commit b9194a5 into master Jan 7, 2020
@delete-merged-branch delete-merged-branch bot deleted the develop-MLA-345-tensorshape branch January 7, 2020 18:42
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants