Skip to content
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

Implement torch.reshape and Tensor.reshape #5575

Merged
merged 4 commits into from Mar 12, 2018
Merged

Conversation

colesbury
Copy link
Member

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.

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.
@colesbury colesbury requested a review from gchanan March 5, 2018 20:28
@@ -121,6 +121,93 @@ Tensor repeat(const Tensor& self, IntList repeats) {
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.

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.

view_d--;
}
if (view_numel != tensor_numel) {
return {};

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@soumith soumith merged commit a264150 into pytorch:master Mar 12, 2018
@colesbury colesbury deleted the reshape branch March 12, 2018 21:24
@fmassa fmassa mentioned this pull request Mar 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants