mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
Summary:
This is an automatic change generated by the following script:
```
#!/usr/bin/env python3
from subprocess import check_output, check_call
import os
def get_compiled_files_list():
import json
with open("build/compile_commands.json") as f:
data = json.load(f)
files = [os.path.relpath(node['file']) for node in data]
for idx, fname in enumerate(files):
if fname.startswith('build/') and fname.endswith('.DEFAULT.cpp'):
files[idx] = fname[len('build/'):-len('.DEFAULT.cpp')]
return files
def run_clang_tidy(fname):
check_call(["python3", "tools/clang_tidy.py", "-c", "build", "-x", fname,"-s"])
changes = check_output(["git", "ls-files", "-m"])
if len(changes) == 0:
return
check_call(["git", "commit","--all", "-m", f"NOLINT stubs for {fname}"])
def main():
git_files = check_output(["git", "ls-files"]).decode("ascii").split("\n")
compiled_files = get_compiled_files_list()
for idx, fname in enumerate(git_files):
if fname not in compiled_files:
continue
if fname.startswith("caffe2/contrib/aten/"):
continue
print(f"[{idx}/{len(git_files)}] Processing {fname}")
run_clang_tidy(fname)
if __name__ == "__main__":
main()
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/56892
Reviewed By: H-Huang
Differential Revision: D27991944
Pulled By: malfet
fbshipit-source-id: 5415e1eb2c1b34319a4f03024bfaa087007d7179
35 lines
1.9 KiB
C++
35 lines
1.9 KiB
C++
#include "caffe2/operators/tensor_protos_db_input.h"
|
|
|
|
namespace caffe2 {
|
|
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
|
REGISTER_CPU_OPERATOR(TensorProtosDBInput, TensorProtosDBInput<CPUContext>);
|
|
|
|
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
|
OPERATOR_SCHEMA(TensorProtosDBInput)
|
|
.NumInputs(1)
|
|
.NumOutputs(1, INT_MAX)
|
|
.SetDoc(R"DOC(
|
|
TensorProtosDBInput is a simple input operator that basically reads things
|
|
from a db where each key-value pair stores an index as key, and a TensorProtos
|
|
object as value. These TensorProtos objects should have the same size, and they
|
|
will be grouped into batches of the given size. The DB Reader is provided as
|
|
input to the operator and it returns as many output tensors as the size of the
|
|
TensorProtos object. Each output will simply be a tensor containing a batch of
|
|
data with size specified by the 'batch_size' argument containing data from the
|
|
corresponding index in the TensorProtos objects in the DB.
|
|
)DOC")
|
|
.Arg("batch_size", "(int, default 0) the number of samples in a batch. The "
|
|
"default value of 0 means that the operator will attempt to insert the "
|
|
"entire data in a single output blob.")
|
|
.Input(0, "data", "A pre-initialized DB reader. Typically, this is obtained "
|
|
"by calling CreateDB operator with a db_name and a db_type. The "
|
|
"resulting output blob is a DB Reader tensor")
|
|
.Output(0, "output", "The output tensor in which the batches of data are "
|
|
"returned. The number of output tensors is equal to the size of "
|
|
"(number of TensorProto's in) the TensorProtos objects stored in the "
|
|
"DB as values. Each output tensor will be of size specified by the "
|
|
"'batch_size' argument of the operator");
|
|
|
|
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
|
NO_GRADIENT(TensorProtosDBInput);
|
|
} // namespace caffe2
|