Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DO NOT MERGE: Break the cpp in ctorch.cpp, shopuld be caught by clang checker. #198

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/ctorch.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <torch/script.h>

Check notice on line 1 in src/ctorch.cpp

View workflow job for this annotation

GitHub Actions / static-analysis

Run clang-format on src/ctorch.cpp

File src/ctorch.cpp does not conform to Custom style guidelines. (lines 46, 69)
#include <torch/torch.h>

#include "ctorch.h"
Expand All @@ -11,6 +11,7 @@
exit(EXIT_FAILURE);
case torch_kInt8:
return torch::kInt8;

case torch_kInt16:
return torch::kInt16;
case torch_kInt32:
Expand Down Expand Up @@ -42,8 +43,7 @@
return torch::Device(torch::kCPU);
case torch_kCUDA:
if (device_index == -1) {
std::cerr << "[WARNING]: device index unset, defaulting to 0"
<< std::endl;
std::cerr << "[WARNING]: device index unset, defaulting to 0" << std::endl;
device_index = 0;
}
if (device_index >= 0 && device_index < torch::cuda::device_count()) {
Expand All @@ -66,9 +66,7 @@
auto model = static_cast<torch::jit::script::Module *>(module);
if (is_training) {
model->train();
} else {
model->eval();
}
} else {model->eval();}
}

torch_tensor_t torch_zeros(int ndim, const int64_t *shape, torch_data_t dtype,
Expand Down
Loading