-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Expand file tree
/
Copy pathModel.cpp
More file actions
53 lines (43 loc) · 1.58 KB
/
Copy pathModel.cpp
File metadata and controls
53 lines (43 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// ----------------------------------------------------------------------------
// - Open3D: www.open3d.org -
// ----------------------------------------------------------------------------
// Copyright (c) 2018-2024 www.open3d.org
// SPDX-License-Identifier: MIT
// ----------------------------------------------------------------------------
#include "open3d/ml/Model.h"
#include "open3d/utility/Logging.h"
namespace open3d {
namespace ml {
struct Model::Impl {
std::string artifact_path_;
bool loaded_ = false;
};
Model::Model() : impl_(std::make_unique<Impl>()) {}
Model::~Model() = default;
void Model::LoadModel(const std::string& artifact_path) {
// TODO: Implement dlopen of libtorch and AOTInductor runner loading.
// For now, just store the path and mark as loaded for testing purposes.
impl_->artifact_path_ = artifact_path;
impl_->loaded_ = true;
utility::LogInfo("Model::LoadModel called with path: {}", artifact_path);
}
std::vector<core::Tensor> Model::Forward(
const std::vector<core::Tensor>& inputs) const {
if (!impl_->loaded_) {
utility::LogError("Model not loaded. Call LoadModel() first.");
}
// TODO: Implement actual inference using AOTInductor runner.
// For now, return empty vector as placeholder.
utility::LogInfo("Model::Forward called with {} input tensors",
inputs.size());
return {};
}
bool IsPyTorchRuntimeEnabled() {
#if OPEN3D_BUILD_PYTORCH_OPS
return true;
#else
return false;
#endif
}
} // namespace ml
} // namespace open3d