Removed identity function because ist is incorrect.
This commit is contained in:
19
tensor.c
19
tensor.c
@@ -139,25 +139,6 @@ int tensor_init_rand(tensor t, int dimension, const int *size, int max)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tensor_init_identity(tensor t, int dimension, int size)
|
|
||||||
{
|
|
||||||
int i ,j;
|
|
||||||
int *indx = malloc(sizeof(int) * dimension);
|
|
||||||
|
|
||||||
for(i = 0; i < dimension; i++) indx[i] = size;
|
|
||||||
if(!tensor_init_zero(t, dimension, indx)) {
|
|
||||||
free(indx);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
for(j = 0; j < size; j++) {
|
|
||||||
for(i = 0; i < dimension; i++) indx[i] = j;
|
|
||||||
tensor_set(t, indx, 1);
|
|
||||||
}
|
|
||||||
free(indx);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void tensor_for_each_elem(tensor t, dtype (*func)(dtype))
|
void tensor_for_each_elem(tensor t, dtype (*func)(dtype))
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|||||||
1
tensor.h
1
tensor.h
@@ -32,7 +32,6 @@ dtype tensor_get(const tensor t, const int *index, int *success);
|
|||||||
int tensor_init_one(tensor t, int dimension, const int *size);
|
int tensor_init_one(tensor t, int dimension, const int *size);
|
||||||
int tensor_init_zero(tensor t, int dimension, const int *size);
|
int tensor_init_zero(tensor t, int dimension, const int *size);
|
||||||
int tensor_init_rand(tensor t, int dimension, const int *size, int max);
|
int tensor_init_rand(tensor t, int dimension, const int *size, int max);
|
||||||
int tensor_init_identity(tensor t, int dimension, int size);
|
|
||||||
|
|
||||||
void tensor_for_each_elem(tensor t, dtype (*func)(dtype));
|
void tensor_for_each_elem(tensor t, dtype (*func)(dtype));
|
||||||
void tensor_print(const tensor t);
|
void tensor_print(const tensor t);
|
||||||
|
|||||||
Reference in New Issue
Block a user