Skip to content

Conversation

@gujinghui
Copy link
Collaborator

@gujinghui gujinghui commented Apr 30, 2019

implement transpose operator for MKLDNN

  1. upgrade mkldnn-bridge to support ND transpose
  2. implement transpose operator in caffe2.

@pytorchbot pytorchbot added caffe2 module: pybind Related to our Python bindings / interactions with other Python libraries module: third_party labels Apr 30, 2019
@gujinghui
Copy link
Collaborator Author

gujinghui commented May 5, 2019

@gujinghui
Copy link
Collaborator Author

gujinghui commented May 5, 2019

@yinghai & @bddppq

This PR is for ND transpose.
Pls help review.

@Jianhui-Li
Copy link

@bddppq We have upgrade the ideep transpose so handle more than just 4d mkl-dnn tensor. We were not sure where we should use it to support torch.transpose. torch.transpose(tensor, dim0, dim1) doesn't change the data buffer layout until contiguous() is called. But mkl-dnn tensor is not supposed to be contiguous tensor. So this PR only contain the Caffe2 transpose op for your reference. Do you have any suggestion how it can be used to speedup Pytorch op?

@gujinghui
Copy link
Collaborator Author

rebased. pls help review.

PenghuiCheng added a commit to PenghuiCheng/pytorch that referenced this pull request May 15, 2019
  Matrix multiplication with bias $Y = A * B + Bias$, where `A` has size (M x K) or (Batch_size x M x k),
  `B` has size (K x N), `Bias` has size (n), and `Y` will have a size (M x N) or (Batch_size x M x N).
  To transpose `A` or `B` before multiplication, pass 1 to the `trans_a` and/or `trans_b` arguments,
  which  separate the first and second dimensions of the respective matrices using `axis_a` and `axis_b`.

  This patch depend on pytorch#19955.
Change-Id: Iea33d609f814a062d4e2b1b48a96e8a1da9f1072
Signed-off-by: Gu, Jinghui <jinghui.gu@intel.com>
@gujinghui
Copy link
Collaborator Author

gujinghui commented May 16, 2019

rebased. depends on #20569 now. pls merge #20569 first.

@VitalyFedyunin VitalyFedyunin added the module: mkldnn Related to Intel IDEEP or oneDNN (a.k.a. mkldnn) integration label May 30, 2019
Copy link
Contributor

@bddppq bddppq left a comment

Choose a reason for hiding this comment

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

LGTM

remove extra parenthesis in transpose_op_test.py
@ezyang
Copy link
Contributor

ezyang commented Jun 6, 2019

@pytorchbot rebase this please

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@ezyang is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@bddppq has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@bddppq
Copy link
Contributor

bddppq commented Jun 11, 2019

Could you add transpose aten op in a follow up diff? :-)

@gujinghui
Copy link
Collaborator Author

Sure. We will work on it.

@facebook-github-bot
Copy link
Contributor

@bddppq merged this pull request in 29c849f.

@XiaobingSuper
Copy link
Collaborator

@bddppq, add transpose aten op in #21943.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

caffe2 module: mkldnn Related to Intel IDEEP or oneDNN (a.k.a. mkldnn) integration module: pybind Related to our Python bindings / interactions with other Python libraries module: third_party open source

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants