Caffe2 - C++ API
A deep learning, cross platform ML framework
python_error_messages.h
1 #pragma once
2 
3 #include <sstream>
4 
5 namespace torch { namespace autograd { namespace utils {
6 
7 inline std::string requires_grad_leaf_error(bool requires_grad) {
8  std::ostringstream oss;
9  oss << "you can only change requires_grad flags of leaf variables.";
10  if (requires_grad == false) {
11  oss << " If you want to use a computed variable in a subgraph "
12  "that doesn't require differentiation use "
13  "var_no_grad = var.detach().";
14  }
15  return oss.str();
16 }
17 
18 }}} // namespace torch::autograd::utils
Definition: jit_type.h:17