Viewing a single comment thread. View all comments

bironsecret t1_itvcys6 wrote

you can't reshape without knowing the shape bro

5

Baggins95 t1_itvy1g6 wrote

In many interesting cases this is actually very possible, e.g. broadcasting x.reshape(1, -1) * y.reshape(-1, 1) Rarely do I need to query the shape explicitly. Mostly a squeeze/unsqueeze leads to the goal. And often one knows the structure of the data explicitly, e.g. the dimensionality of a Euclidean space. I don't want to deny the use case for .shape entirely, but I think often it can be avoided.

1

bironsecret t1_itw7v9y wrote

can't agree, for unknown shapes I use permute or x.reshape(x.shape/2, x.shape/2) etc

1