Skip to content

Commit

Permalink
Convert toOpMathType to an inline function, to fix test breakages (py…
Browse files Browse the repository at this point in the history
…torch#81463)

Summary:
Ideally function implementations in headers should be inline, class functions, or moved into cpp files. Otherwise we'll end up with errors when these headers are imported into targets that break on unused function warnings. This header was recently imported into the PyTorchPlaygroundTests target, breaking it. Making this function inline unbreaks these tests.

Related discussion:
https://fb.workplace.com/groups/474291069286180/permalink/5228784980503408/

Test Plan: Build and run tests.

Differential Revision: D37850416

Pull Request resolved: pytorch#81463
Approved by: https://github.com/ngimel
  • Loading branch information
jmdetloff authored and pytorchmergebot committed Jul 15, 2022
1 parent dc84963 commit b95ae29
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion aten/src/ATen/OpMathType.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ using opmath_type = typename OpMathType<T>::type;

namespace {

c10::ScalarType toOpMathType(const c10::ScalarType type) {
inline c10::ScalarType toOpMathType(const c10::ScalarType type) {
switch (type) {
#define DEFINE_CASE(scalar_t, TypeNum) \
case ScalarType::TypeNum: \
Expand Down

0 comments on commit b95ae29

Please sign in to comment.