add static to test-grad0.c internal functions
This commit is contained in:
parent
49580fe816
commit
0b206788dc
1 changed files with 9 additions and 9 deletions
|
@ -47,16 +47,16 @@
|
||||||
|
|
||||||
#define GGML_PRINT(...) printf(__VA_ARGS__)
|
#define GGML_PRINT(...) printf(__VA_ARGS__)
|
||||||
|
|
||||||
float frand(void) {
|
static float frand(void) {
|
||||||
return (float)rand()/(float)RAND_MAX;
|
return (float)rand()/(float)RAND_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
int irand(int n) {
|
static int irand(int n) {
|
||||||
if (n == 0) return 0;
|
if (n == 0) return 0;
|
||||||
return rand()%n;
|
return rand()%n;
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_random_dims(int64_t * dims, int ndims) {
|
static void get_random_dims(int64_t * dims, int ndims) {
|
||||||
dims[0] = dims[1] = dims[2] = dims[3] = 1;
|
dims[0] = dims[1] = dims[2] = dims[3] = 1;
|
||||||
|
|
||||||
for (int i = 0; i < ndims; i++) {
|
for (int i = 0; i < ndims; i++) {
|
||||||
|
@ -64,7 +64,7 @@ void get_random_dims(int64_t * dims, int ndims) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ggml_tensor * get_random_tensor_f32(
|
static struct ggml_tensor * get_random_tensor_f32(
|
||||||
struct ggml_context * ctx0,
|
struct ggml_context * ctx0,
|
||||||
int ndims,
|
int ndims,
|
||||||
int64_t ne[],
|
int64_t ne[],
|
||||||
|
@ -112,7 +112,7 @@ struct ggml_tensor * get_random_tensor_f32(
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ggml_tensor * get_random_tensor_f16(
|
static struct ggml_tensor * get_random_tensor_f16(
|
||||||
struct ggml_context * ctx0,
|
struct ggml_context * ctx0,
|
||||||
int ndims,
|
int ndims,
|
||||||
int64_t ne[],
|
int64_t ne[],
|
||||||
|
@ -160,7 +160,7 @@ struct ggml_tensor * get_random_tensor_f16(
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ggml_tensor * get_random_tensor_i32(
|
static struct ggml_tensor * get_random_tensor_i32(
|
||||||
struct ggml_context * ctx0,
|
struct ggml_context * ctx0,
|
||||||
int ndims,
|
int ndims,
|
||||||
int64_t ne[],
|
int64_t ne[],
|
||||||
|
@ -208,7 +208,7 @@ struct ggml_tensor * get_random_tensor_i32(
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_elements(const char* label, const struct ggml_tensor * t) {
|
static void print_elements(const char* label, const struct ggml_tensor * t) {
|
||||||
if (!t) {
|
if (!t) {
|
||||||
printf("%s: %s = null\n", __func__, label);
|
printf("%s: %s = null\n", __func__, label);
|
||||||
return;
|
return;
|
||||||
|
@ -228,7 +228,7 @@ void print_elements(const char* label, const struct ggml_tensor * t) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool check_gradient(
|
static bool check_gradient(
|
||||||
const char * op_name,
|
const char * op_name,
|
||||||
struct ggml_context * ctx0,
|
struct ggml_context * ctx0,
|
||||||
struct ggml_tensor * x[],
|
struct ggml_tensor * x[],
|
||||||
|
@ -310,7 +310,7 @@ bool check_gradient(
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: clean-up this ..
|
// TODO: clean-up this ..
|
||||||
bool check_mat_mul(
|
static bool check_mat_mul(
|
||||||
const struct ggml_tensor * y,
|
const struct ggml_tensor * y,
|
||||||
const struct ggml_tensor * x0,
|
const struct ggml_tensor * x0,
|
||||||
const struct ggml_tensor * x1) {
|
const struct ggml_tensor * x1) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue