Skip to content

Conversation

@VitalyFedyunin
Copy link
Contributor

@VitalyFedyunin VitalyFedyunin commented Oct 18, 2019

Stack from ghstack:

Differential Revision: D18044977

@VitalyFedyunin
Copy link
Contributor Author

@ngimel I will add tests and benchmark results, so far I just looking your opinion on structure.

# lambda x, y: x.abs(), # https://github.com/pytorch/pytorch/issues/24531
# lambda x, y: x.acos(), # https://github.com/pytorch/pytorch/issues/24532
lambda x, y: x.add(y, alpha=3),
lambda x, y: x.addcdiv(2, y, y),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given that y is contiguous, what are we testing here? Should it have been x, y in the arguments (same for addcmul)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed by adding more tests

op.tensor = at::empty(tensor_shape, op.options());
op.tensor.unsafeGetTensorImpl()->empty_tensor_restride(
MemoryFormat::ChannelsLast);
op.stride_bytes = apply_perm_and_mul(op.tensor.strides(), element_size);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot convince myself that op.stride_bytes and op.tensor.strides() are guaranteed to be consistent (one is defined by perm_ which can be whatever, and the other is hardcoded nhwc), and tests are only testing contiguity of output which is guaranteed by empty_tensor_restride, not its correctness.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed by adding comment

@facebook-github-bot
Copy link
Contributor

@VitalyFedyunin merged this pull request in a7df369.

zdevito pushed a commit to zdevito/ATen that referenced this pull request Nov 18, 2019
Summary: Pull Request resolved: pytorch/pytorch#28291

Test Plan: Imported from OSS

Differential Revision: D18044977

Pulled By: VitalyFedyunin

fbshipit-source-id: 793bab47d8cfc1b0d6229f1b0688352ee94c3e48
@facebook-github-bot facebook-github-bot deleted the gh/VitalyFedyunin/17/head branch November 21, 2019 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants