Submitted by popcornn1 t3_ydw9wv in MachineLearning
bironsecret t1_itvcys6 wrote
Reply to comment by Baggins95 in [D] Python function that changed your life in regard to Machine Learning by popcornn1
you can't reshape without knowing the shape bro
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.
bironsecret t1_itw7v9y wrote
can't agree, for unknown shapes I use permute or x.reshape(x.shape/2, x.shape/2) etc
Viewing a single comment thread. View all comments