1 #include <torch/csrc/autograd/functions/basic_ops.h> 3 #include <torch/csrc/autograd/function.h> 4 #include <torch/csrc/autograd/variable.h> 5 #include <torch/csrc/autograd/functions/utils.h> 12 namespace torch {
namespace autograd {
14 auto Error::apply(variable_list&& inputs) -> variable_list {
15 throw std::runtime_error(msg);
18 auto DelayedError::apply(variable_list&& inputs) -> variable_list {
20 outputs.reserve(inputs.size());
21 for (
auto& var : inputs) {
23 outputs.emplace_back(var.defined() ? var.data() :
at::Tensor());
25 return wrap_outputs(inputs, std::move(outputs), [&](edge_list&& next_edges) {
26 return std::make_shared<Error>(msg, std::move(next_edges));