NVIDIA Holoscan SDK v2.0.0
Holoscan v2.0.0

Program Listing for File core.hpp

Return to documentation for file (modules/holoinfer/src/infer/torch/core.hpp)

Copy
Copied!
            

/* * SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef _HOLOSCAN_TORCH_INFER_CORE_H #define _HOLOSCAN_TORCH_INFER_CORE_H #include <chrono> #include <cmath> #include <exception> #include <filesystem> #include <fstream> #include <iostream> #include <limits> #include <list> #include <memory> #include <numeric> #include <sstream> #include <string> #include <vector> #include <holoinfer_constants.hpp> #include <holoinfer_utils.hpp> #include <infer/infer.hpp> namespace holoscan { namespace inference { class TorchInferImpl; class TorchInfer : public InferBase { public: TorchInfer(const std::string& model_file_path, bool cuda_flag, bool cuda_buf_in, bool cuda_buf_out); ~TorchInfer(); InferStatus do_inference(const std::vector<std::shared_ptr<DataBuffer>>& input_data, std::vector<std::shared_ptr<DataBuffer>>& output_buffer); InferStatus populate_model_details(); void print_model_details(); std::vector<std::vector<int64_t>> get_input_dims() const; std::vector<std::vector<int64_t>> get_output_dims() const; std::vector<holoinfer_datatype> get_input_datatype() const; std::vector<holoinfer_datatype> get_output_datatype() const; private: TorchInferImpl* impl_ = nullptr; }; } // namespace inference } // namespace holoscan #endif

© Copyright 2022-2024, NVIDIA. Last updated on Jun 4, 2024.