Removed scalar operations on tensors because they can be done with iterators.
This commit is contained in:
36
tensor.c
36
tensor.c
@@ -186,42 +186,6 @@ uint8_t tensor_cpy(tensor t1, const tensor t2)
|
||||
return 1;
|
||||
}
|
||||
|
||||
void tensor_add_scalar(tensor t, dtype n)
|
||||
{
|
||||
assert(!tensor_is_empty(t));
|
||||
|
||||
tensoriter_scalar iter = tensoriter_scalar_create(t);
|
||||
tensoriter_scalar_map_add(iter, n);
|
||||
tensoriter_scalar_destroy(iter);
|
||||
}
|
||||
|
||||
void tensor_sub_scalar(tensor t, dtype n)
|
||||
{
|
||||
assert(!tensor_is_empty(t));
|
||||
|
||||
tensoriter_scalar iter = tensoriter_scalar_create(t);
|
||||
tensoriter_scalar_map_sub(iter, n);
|
||||
tensoriter_scalar_destroy(iter);
|
||||
}
|
||||
|
||||
void tensor_mul_scalar(tensor t, dtype n)
|
||||
{
|
||||
assert(!tensor_is_empty(t));
|
||||
|
||||
tensoriter_scalar iter = tensoriter_scalar_create(t);
|
||||
tensoriter_scalar_map_mul(iter, n);
|
||||
tensoriter_scalar_destroy(iter);
|
||||
}
|
||||
|
||||
void tensor_div_scalar(tensor t, dtype n)
|
||||
{
|
||||
assert(!tensor_is_empty(t));
|
||||
|
||||
tensoriter_scalar iter = tensoriter_scalar_create(t);
|
||||
tensoriter_scalar_map_div(iter, n);
|
||||
tensoriter_scalar_destroy(iter);
|
||||
}
|
||||
|
||||
uint8_t tensor_add_inplace(tensor t1, const tensor t2)
|
||||
{
|
||||
assert(!tensor_is_empty(t1));
|
||||
|
||||
4
tensor.h
4
tensor.h
@@ -55,10 +55,6 @@ uint8_t tensor_init_zero(tensor t, uint8_t rank, const uint32_t *size);
|
||||
uint8_t tensor_init_rand(tensor t, uint8_t rank, const uint32_t *size, dtype max);
|
||||
uint8_t tensor_cpy(tensor t1, const tensor t2);
|
||||
|
||||
void tensor_add_scalar(tensor t, dtype n);
|
||||
void tensor_sub_scalar(tensor t, dtype n);
|
||||
void tensor_mul_scalar(tensor t, dtype n);
|
||||
void tensor_div_scalar(tensor t, dtype n);
|
||||
uint8_t tensor_add_inplace(tensor t1, const tensor t2);
|
||||
uint8_t tensor_sub_inplace(tensor t1, const tensor t2);
|
||||
tensor tensor_add(const tensor t1, const tensor t2);
|
||||
|
||||
Reference in New Issue
Block a user