reid from https://github.com/michuanhaohao/reid-strong-baseline
zhangmeng
2020-01-17 f7c4a3cfd07adede3308f8d9d3d7315427d90a7c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#pragma once
 
#include <sstream>
 
namespace torch { namespace autograd { namespace utils {
 
inline std::string requires_grad_leaf_error(bool requires_grad) {
  std::ostringstream oss;
  oss << "you can only change requires_grad flags of leaf variables.";
  if (requires_grad == false) {
      oss << " If you want to use a computed variable in a subgraph "
             "that doesn't require differentiation use "
             "var_no_grad = var.detach().";
  }
  return oss.str();
}
 
}}} // namespace torch::autograd::utils