7 #include <torch/csrc/utils/hash.h> 9 namespace torch {
namespace autograd {
17 Edge(std::shared_ptr<Function> function_, uint32_t input_nr_) noexcept
18 :
function(std::move(function_)),
input_nr(input_nr_) {}
22 return function !=
nullptr;
26 bool operator==(
const Edge& other)
const noexcept {
30 bool operator!=(
const Edge& other)
const noexcept {
31 return !(*
this == other);
35 std::shared_ptr<Function>
function;
48 struct hash<
torch::autograd::Edge> {
51 using return_type = size_t;
52 return_type operator()(
const argument_type& edge)
const noexcept {
bool is_valid() const noexcept
Convenience method to test if an edge is valid.
Represents a particular input of a function.
uint32_t input_nr
The identifier of a particular input to the function.
std::shared_ptr< Function > function
The function this Edge points to.