forked from GraphBLAS/binsparse-reference-c
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtensor_test.c
More file actions
28 lines (26 loc) · 711 Bytes
/
tensor_test.c
File metadata and controls
28 lines (26 loc) · 711 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
* SPDX-FileCopyrightText: 2024 Binsparse Developers
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <binsparse/read_tensor.h>
#include <binsparse/tensor.h>
#include <binsparse/write_tensor.h>
int main(int argc, char** argv) {
if (argc < 3) {
fprintf(stderr,
"usage: ./tensor_test [file_name.h5] [output_file_name.h5]\n");
return 1;
}
char* file_name = argv[1];
bsp_tensor_t tensor = bsp_read_tensor(argv[1], NULL);
printf("rank: %d\n", tensor.rank);
printf("dims:");
for (int i = 0; i < tensor.rank; i++) {
printf("%ld, ", tensor.dims[i]);
}
printf("\n");
bsp_write_tensor(argv[2], tensor, NULL, NULL, 9);
bsp_destroy_tensor_t(tensor);
return 0;
}