From 3cb2f272eb9c99d0140d984f12b7c4906f8bc155 Mon Sep 17 00:00:00 2001 From: Elias Kohout Date: Fri, 24 Feb 2023 21:04:26 +0100 Subject: [PATCH] Removed identity function because ist is incorrect. --- tensor.c | 19 ------------------- tensor.h | 1 - 2 files changed, 20 deletions(-) diff --git a/tensor.c b/tensor.c index 64d031c..39610a6 100644 --- a/tensor.c +++ b/tensor.c @@ -139,25 +139,6 @@ int tensor_init_rand(tensor t, int dimension, const int *size, int max) 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)) { int i; diff --git a/tensor.h b/tensor.h index 5f5fa57..125d02d 100644 --- a/tensor.h +++ b/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_zero(tensor t, int dimension, const int *size); 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_print(const tensor t);