MCPcopy Create free account
hub / github.com/AnswerDotAI/gpu.cpp / size

Function size

gpu.hpp:86–92  ·  view source on GitHub ↗

* @brief Returns the number of elements in a tensor with the given shape, * which is equal to the product of the dimensions. * @param[in] shape Shape of the tensor * @return Number of elements in the tensor * * @code * size({256, 256}) -> 65536 * @endcode */

Source from the content-addressed store, hash-verified

84 * @endcode
85 */
86inline size_t size(const Shape &shape) {
87 size_t numels = 1;
88 for (size_t i = 0; i < shape.rank; i++) {
89 numels *= shape.data[i];
90 }
91 return numels;
92}
93
94/**
95 * @brief Represents a tensor on the GPU, which is a buffer of values with a

Callers 3

createTensorFunction · 0.85
mainFunction · 0.85
createTransformerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected