Skip to content

a sample of cnpy load int8_t npy #99

Description

@lix19937
  #include "cnpy.h"
  
  auto readnpy_int8_t = [](const std::string &npy_name, int read_num) -> std::vector<int8_t>
  {
    cnpy::NpyArray arr = cnpy::npy_load(npy_name);
    std::vector<int8_t> read_vec(read_num);
    auto loaded_data = arr.data<int8_t>();

    for (int i = 0; i < read_num; ++i)
    {
      read_vec[i] = loaded_data[i];
    }
    return read_vec;
  };
  std::vector<int8_t> data_vec = readnpy_int8_t("./out.npy", h * w);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions