MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / Index

Method Index

paddle/phi/core/selected_rows_impl.h:80–87  ·  view source on GitHub ↗

* @brief Get the index of key in rows * * @return -1 if the key does not exists. */

Source from the content-addressed store, hash-verified

78 * @return -1 if the key does not exists.
79 */
80 int64_t Index(int64_t key) const {
81 auto it = std::find(rows_.begin(), rows_.end(), key);
82 if (it == rows_.end()) {
83 PADDLE_THROW(common::errors::NotFound(
84 "Input id (%lld) is not in current rows table.", key));
85 }
86 return static_cast<int64_t>(std::distance(rows_.begin(), it));
87 }
88
89 /*
90 * @brief whether has the specified key in the table.

Callers

nothing calls this directly

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected