Skip to content

Commit

Permalink
fix(cc): compile select_map<int> when TensorFlow backend is off (#3987
Browse files Browse the repository at this point in the history
)

`select_map<int>` is currently within the `BUILD_TENSORFLOW` condition
block, which is wrong. The C API uses it. This issue is found on a
machine when only building against libtorch.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Improved compatibility with TensorFlow by adding conditional
compilation directives.
  
- **Enhancements**
- Enhanced handling of session data with new template functions for
vectors and scalars.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Jinzhe Zeng <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
njzjz and pre-commit-ci[bot] authored Jul 18, 2024
1 parent 0c0878e commit 2af69f9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions source/api_cc/src/common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,7 @@ template void deepmd::session_get_vector<int>(std::vector<int>&,
Session*,
const std::string,
const std::string);
#endif

template void deepmd::select_map<int>(std::vector<int>& out,
const std::vector<int>& in,
Expand Down Expand Up @@ -1025,6 +1026,7 @@ template void deepmd::select_map_inv<int>(
const std::vector<int>& idx_map,
const int& stride);

#ifdef BUILD_TENSORFLOW
template float deepmd::session_get_scalar<float>(Session*,
const std::string,
const std::string);
Expand Down

0 comments on commit 2af69f9

Please sign in to comment.