Files
sunnypilot/third_party/snpe/include/DlSystem/TensorMap.hpp

121 lines
2.6 KiB
C++
Raw Normal View History

modeld: retain SNPE and thneed drive model support (#555) * modeld: Retain pre-20hz drive model support * Method not available anymore on OP * some fixes * Revert "Long planner get accel: new function args (#34288)" * Revert "Fix low-speed allow_throttle behavior in long planner (#33894)" * Revert "long planner: allow throttle reflects usage (#33792)" * Revert "Gate acceleration on model gas press predictions (#33643)" * Reapply "Gate acceleration on model gas press predictions (#33643)" This reverts commit 76b08e37cb8eb94266ad9f6fed80db227e7c3428. * Reapply "long planner: allow throttle reflects usage (#33792)" This reverts commit c75244ca4e9c48084b0205b7c871e1a4e0f4e693. * Reapply "Fix low-speed allow_throttle behavior in long planner (#33894)" This reverts commit b2b7d21b7b685a2785d1beede3d223f0bb954807. * Reapply "Long planner get accel: new function args (#34288)" This reverts commit 74dca2fccf4da59cc8ac62ba9c0ad10ba3fc264b. * don't need * retain snpe * wrong * they're symlinks * remove * put back into VCS * add back * don't include built * Refactor model runner retrieval with caching support Added caching for active model runner type via `ModelRunnerTypeCache` to enhance performance and avoid redundant checks. Introduced a `force_check` flag to bypass the cache when necessary. Updated related code to handle cache clearing during onroad transitions. * Update model runner determination logic with caching fix Enhances `get_active_model_runner` to utilize caching more effectively by ensuring type consistency and updating cache only when necessary. Also updates `is_snpe_model` to pass the `started` state to the runner determination function, improving behavior for dynamic checks. * default to none * enable in next PR * more --------- Co-authored-by: DevTekVE <devtekve@gmail.com>
2025-01-10 18:34:06 -05:00
//=============================================================================
//
// Copyright (c) 2016 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
//
//=============================================================================
#include <memory>
#include "ZdlExportDefine.hpp"
#include "ITensor.hpp"
#include "StringList.hpp"
#ifndef DL_SYSTEM_TENSOR_MAP_HPP
#define DL_SYSTEM_TENSOR_MAP_HPP
namespace DlSystem
{
// Forward declaration of tensor map implementation.
class TensorMapImpl;
}
namespace zdl
{
namespace DlSystem
{
/** @addtogroup c_plus_plus_apis C++
@{ */
/**
* @brief .
*
* A class representing the map of tensor.
*/
class ZDL_EXPORT TensorMap final
{
public:
/**
* @brief .
*
* Creates a new empty tensor map
*/
TensorMap();
/**
* copy constructor.
* @param[in] other object to copy.
*/
TensorMap(const TensorMap& other);
/**
* assignment operator.
*/
TensorMap& operator=(const TensorMap& other);
/**
* @brief Adds a name and the corresponding tensor pointer
* to the map
*
* @param[in] name The name of the tensor
* @param[out] tensor The pointer to the tensor
*
* @note If a tensor with the same name already exists, the
* tensor is replaced with the existing tensor.
*/
void add(const char *name, zdl::DlSystem::ITensor *tensor);
/**
* @brief Removes a mapping of tensor and its name by its name
*
* @param[in] name The name of tensor to be removed
*
* @note If no tensor with the specified name is found, nothing
* is done.
*/
void remove(const char *name) noexcept;
/**
* @brief Returns the number of tensors in the map
*/
size_t size() const noexcept;
/**
* @brief .
*
* Removes all tensors from the map
*/
void clear() noexcept;
/**
* @brief Returns the tensor given its name.
*
* @param[in] name The name of the tensor to get.
*
* @return nullptr if no tensor with the specified name is
* found; otherwise, a valid pointer to the tensor.
*/
zdl::DlSystem::ITensor* getTensor(const char *name) const noexcept;
/**
* @brief .
*
* Returns the names of all tensors
*/
zdl::DlSystem::StringList getTensorNames() const;
~TensorMap();
private:
void swap(const TensorMap &other);
std::unique_ptr<::DlSystem::TensorMapImpl> m_TensorMapImpl;
};
} // DlSystem namespace
} // zdl namespace
/** @} */ /* end_addtogroup c_plus_plus_apis C++ */
#endif // DL_SYSTEM_TENSOR_MAP_HPP