-
Notifications
You must be signed in to change notification settings - Fork 25.5k
Implement torch.reshape and Tensor.reshape #5575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This implements reshape which has similar semantics to numpy.reshape. It will return a view of the source tensor if possible. Otherwise, it returns a copy.
return result; | ||
} | ||
|
||
static std::vector<int64_t> infer_size(IntList shape, int64_t numel) { |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
static std::vector<int64_t> infer_size(IntList shape, int64_t numel) { | ||
auto res = shape.vec(); | ||
int64_t newsize = 1; | ||
auto infer_dim = at::optional<int64_t>(); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
view_d--; | ||
} | ||
if (view_numel != tensor_numel) { | ||
return {}; |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This implements reshape which has similar semantics to numpy.reshape. It
will return a view of the source tensor if possible. Otherwise, it
returns a copy.