Skip to content
This repository was archived by the owner on Jul 15, 2025. It is now read-only.

Viewing arrays with different shapes #18

Merged
merged 3 commits into from
Feb 18, 2024

Conversation

karllessard
Copy link
Contributor

Returns a view of an NdArray that uses a different, but compatible, shape.

This operation is stateless, meaning that calling ndArray.withShape(newShape) won't modify the shape of ndArray but returns a new array that is actually just a different view of the same data.

Note that in TensorFlow C API, the TF_SetShape operation is stateful and modifies the shape of the tensor, so it cannot be used. Therefore, withShape() on a Tensor will also just return an NdArray view of that tensor (same behaviour asslice).

@karllessard karllessard requested a review from Craigacp February 18, 2024 00:41
Copy link
Contributor

@Craigacp Craigacp left a comment

Choose a reason for hiding this comment

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

Looks fine aside from the equality check.

@karllessard karllessard merged commit e9ff657 into tensorflow:main Feb 18, 2024
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.

2 participants