forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Interpreter support for CallFunction/CallMethod (pytorch#21562)
Summary: Pull Request resolved: pytorch#21562 ghimport-source-id: 17e5e18 Reviewed By: suo Differential Revision: D15729500 Pulled By: zdevito fbshipit-source-id: efa8a133b617b1498810392a8da6b513ce00b5eb
- Loading branch information
1 parent
ad0c08f
commit ea822d9
Showing
19 changed files
with
390 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#pragma once | ||
#include <c10/util/Exception.h> | ||
#include <stdexcept> | ||
|
||
namespace torch { | ||
namespace jit { | ||
|
||
struct ExceptionMessage { | ||
ExceptionMessage(const std::exception& e) : e_(e) {} | ||
|
||
private: | ||
const std::exception& e_; | ||
friend std::ostream& operator<<( | ||
std::ostream& out, | ||
const ExceptionMessage& msg); | ||
}; | ||
|
||
inline std::ostream& operator<<( | ||
std::ostream& out, | ||
const ExceptionMessage& msg) { | ||
auto c10_error = dynamic_cast<const c10::Error*>(&msg.e_); | ||
if (c10_error) { | ||
out << c10_error->msg_without_backtrace(); | ||
} else { | ||
out << msg.e_.what(); | ||
} | ||
return out; | ||
} | ||
|
||
} // namespace jit | ||
} // namespace torch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.