Add mkldnn fallbacks for Resnet50 training ops#8541
Add mkldnn fallbacks for Resnet50 training ops#8541wuhuikx wants to merge 13 commits intopytorch:masterfrom
Conversation
wuhuikx
commented
Jun 15, 2018
- Add fallback gradient ops
- In fallback ops, set the output Tensor as CPUTensor instead of IDEEPTensor if ndim = 0. Because IDEEPTensor doesn't support 0 dim.
|
@yinghai , could you pls help to review code? |
|
Rebase? |
|
Yes, have rebased. |
facebook-github-bot
left a comment
There was a problem hiding this comment.
@yinghai has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
| if (src.ndim() == 0) { | ||
| VLOG(1) << "Copy output: index " << i << " skipped."; | ||
| Blob* dst = OperatorBase::OutputBlob(i); | ||
| dst->Reset(new Tensor<CPUContext>()); |
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.
|
@yinghai Any comments on the updates? OK to merge? |
facebook-github-bot
left a comment
There was a problem hiding this comment.
yinghai has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
@jgong5 Could you rebase? There seems to be merge conflict. |
|
@yinghai I have rebased it yesterday and there is not conflict now. |
facebook-github-bot
left a comment
There was a problem hiding this comment.
yinghai has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
@wuhuikx Could you double check?? |
facebook-github-bot
left a comment
There was a problem hiding this comment.
yinghai has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
yinghai
left a comment
There was a problem hiding this comment.
You need to do
git checkout master
git fetch upstream
git merge upstream/master
to really sync up the code.
| if (src.ndim() == 0) { | ||
| VLOG(1) << "Copy output: index " << i << " skipped."; | ||
| Blob* dst = OperatorBase::OutputBlob(i); | ||
| dst->Reset(new Tensor<CPUContext>()); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
facebook-github-bot
left a comment
There was a problem hiding this comment.
yinghai has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
| if (src.ndim() == 0) { | ||
| VLOG(1) << "Copy output: index " << i << " skipped."; | ||
| Blob* dst = OperatorBase::OutputBlob(i); | ||
| dst->Reset(new Tensor<CPU>()); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
@yinghai Have revised and pass all checks. Pls help review. |
facebook-github-bot
left a comment
There was a problem hiding this comment.
yinghai has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
| VLOG(1) << "Copy output: index " << i << " skipped."; | ||
| Blob* dst = OperatorBase::OutputBlob(i); | ||
| dst->Reset(new Tensor(CPU)); | ||
| auto dtensor = dst->template GetMutable<TensorCPU>(); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
|
@yinghai Revised Done. Sorry for inconvenient. |
|
What is the process for check-in? Import to phabricator and accept from there? |
facebook-github-bot
left a comment
There was a problem hiding this comment.
wesolwsk has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
| "output type who needs copying."); | ||
| const auto& src = local_output_blobs_[i]->template Get<TensorCPU>(); | ||
|
|
||
| auto src_dims = src.dims(); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
facebook-github-bot
left a comment
There was a problem hiding this comment.
wesolwsk has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Summary: 1. Add fallback gradient ops 2. In fallback ops, set the output Tensor as CPUTensor instead of IDEEPTensor if ndim = 0. Because IDEEPTensor doesn't support 0 dim. Pull Request resolved: pytorch#8541 Reviewed By: yinghai Differential Revision: D9115233 Pulled By: wesolwsk fbshipit-source-id: 163e6a76f02bd781c95d1060ccbacf2cab90055e