dpilger26 / NumCpp

C++ implementation of the Python Numpy library
https://dpilger26.github.io/NumCpp
MIT License
3.51k stars 548 forks source link

Doesn't Shape support 4D data processing in NumCpp? #210

Closed wangzhenlin123 closed 5 months ago

wangzhenlin123 commented 5 months ago

Describe the bug "nc::Shape::Shape": no overloaded function takes 4 parameters

To Reproduce Steps to reproduce the behavior: `#include

include

include "NumCpp.hpp"

int main() { // 设置数据形状 constexpr uint32_t dim1 = 512; constexpr uint32_t dim2 = 512; constexpr uint32_t dim3 = 128; constexpr uint32_t dim4 = 3;

nc::Shape shape(dim1, dim2, dim3, dim4);

nc::NdArray<int> data = nc::random::randInt<int>(shape, 0, 100);

constexpr int numTests = 100;

std::chrono::duration<double> totalDuration(0);
for (int i = 0; i < numTests; ++i) {
    auto start = std::chrono::high_resolution_clock::now();
    auto indices = nc::argmax(data, nc::Axis::COL);   //argmax
    auto end = std::chrono::high_resolution_clock::now();
    totalDuration += end - start;
}

// 输出平均执行时间
double averageTime = totalDuration.count() / numTests;
std::cout << "Average time for argmax function: " << averageTime << " seconds." << std::endl;

return 0;

}`

Expected behavior A clear and concise description of what you expected to happen.

Screenshots image "nc::Shape::Shape": no overloaded function takes 4 parameters

dpilger26 commented 5 months ago

This has been asked and answered many times... No it doesn't, please see the documentation.