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

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).

Copy link
Contributor

@CraigacpCraigacp 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.

@karllessardkarllessard merged commit e9ff657 into tensorflow:mainFeb 18, 2024
Sign up for freeto 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

@karllessard@Craigacp