这里有一个奇怪的问题,在 Github 上 TensorFlow 的 C++ 代码部分的不同位置有以下评论:
// NOLINT(build/namespaces)
例如C++标签图像示例有这样的注释:
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/examples/label_image/main.cc#L120
Status ReadTensorFromImageFile(const string& file_name, const int input_height,
const int input_width, const float input_mean,
const float input_std,
std::vector<Tensor>* out_tensors) {
auto root = tensorflow::Scope::NewRootScope();
using namespace ::tensorflow::ops; // NOLINT(build/namespaces)
string input_name = "file_reader";
string output_name = "normalized";
.
.
.
谁能解释一下 //NOLINT(build/namespaces)
是什么意思??我会尝试自己进行更多研究,但我什至不确定从哪里开始。
最佳答案
Linters 是一种以静态方式检查代码风格和正确性的工具。 TensorFlow 开发人员和其他人使用的工具之一是 clang-tidy .
虽然这些工具对于发现错误非常有用,但有时一般检查并不适用(例如在生成的代码、高度优化的代码中或故意使用过时的 API 以实现向后兼容),在这种情况下像 这样的注释//NOLINT
可用于告诉 linter 不要报告错误,以保持较低的误报率和有意义的结果。
这些地方中的每一个都应该说明一个原因,这样开发人员就知道什么被忽略了,为什么,应该定期审查,以便检测到更新引起的变化。
另请参阅抑制部分:http://clang.llvm.org/extra/clang-tidy/#suppressing-undesired-diagnostics
关于c++ - TensorFlow C++ "NOLINT(build/namespaces)"是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53469998/