Program Listing for File ping_tensor_tx.hpp
↰ Return to documentation for file (include/holoscan/operators/ping_tensor_tx/ping_tensor_tx.hpp
)
/*
* SPDX-FileCopyrightText: Copyright (c) 2024 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_OPERATORS_PING_TENSOR_TX_HPP
#define HOLOSCAN_OPERATORS_PING_TENSOR_TX_HPP
#include <memory>
#include <string>
#include <holoscan/holoscan.hpp>
namespace holoscan::ops {
class PingTensorTxOp : public Operator {
public:
HOLOSCAN_OPERATOR_FORWARD_ARGS(PingTensorTxOp)
PingTensorTxOp() = default;
void initialize() override;
void setup(OperatorSpec& spec) override;
void compute(InputContext&, OutputContext& op_output, ExecutionContext& context) override;
nvidia::gxf::PrimitiveType element_type() {
if (element_type_.has_value()) { return element_type_.value(); }
element_type_ = primitive_type(data_type_.get());
return element_type_.value();
}
private:
nvidia::gxf::PrimitiveType primitive_type(const std::string& data_type);
std::optional<nvidia::gxf::PrimitiveType> element_type_;
size_t count_ = 1;
Parameter<std::shared_ptr<Allocator>> allocator_{nullptr};
Parameter<std::string> storage_type_{"system"};
Parameter<int32_t> batch_size_{0};
Parameter<int32_t> rows_{32};
Parameter<int32_t> columns_{64};
Parameter<int32_t> channels_{0};
Parameter<std::string> data_type_{"uint8_t"};
Parameter<std::string> tensor_name_{"tensor"};
};
} // namespace holoscan::ops
#endif/* HOLOSCAN_OPERATORS_PING_TENSOR_TX_HPP */