remove caffe2.pb.h dependency for embedding_lookup_idx.cc (#25670)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/25670

This is part of the effort to get rid of protobuf dependency for
libtorch mobile build.

embedding_lookup_idx.cc is used by ATen/EmbeddingBag.cpp. It indirectly
includes caffe2.pb.h but doesn't really need it. Clean up the headers to
unblock no-protobuf mobile build.

The broader problem is that many common headers in pytorch/caffe2 directly
or indirectly include caffe2.pb.h. After landing the stack of changes to
remove protobuf from OSS libtorch mobile build, it's going to constraint
how ATen and other parts of pytorch use caffe2 components: it will break
OSS mobile CI if a PR introduces a dependency to a caffe2 file that
indirectly includes caffe2.pb.h. We will need to tease out caffe2.pb.h
dependencies like in this diff, or do a refactor to replace protobuf
generated types.

Chatted with gchanan and ezyang to confirm that there is no plan to
add more dependencies to caffe2 components from ATen in near future,
so this should be fine.

Test Plan: - build locally with stacked diffs

Differential Revision: D17191913

Pulled By: ljk53

fbshipit-source-id: 1248fe6424060a8bedcf20e73942b7500ae5e815
This commit is contained in:
Jiakai Liu
2019-09-06 00:53:09 -07:00
committed by Facebook Github Bot
parent a6fb6e1fb3
commit 2bed201190

View File

@ -1,6 +1,8 @@
#include "caffe2/perfkernels/embedding_lookup_idx.h"
#include "caffe2/core/types.h"
#include <c10/util/Half.h>
#include "caffe2/core/common.h"
#include "caffe2/core/logging.h"
#include "caffe2/perfkernels/common.h"
namespace caffe2 {