Skip to content

Commit

Permalink
Remove redundant internal function subtract_tensor
Browse files Browse the repository at this point in the history
  • Loading branch information
Dobiasd committed Jan 1, 2024
1 parent f82b6fd commit 646c71d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
2 changes: 1 addition & 1 deletion include/fdeep/layers/subtract_layer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class subtract_layer : public layer
{
assertion(input.size() == 2,
"subtract layer needs exactly two input tensors");
return {subtract_tensor(input[0], input[1])};
return {subtract_tensors(input[0], input[1])};
}
};

Expand Down
10 changes: 0 additions & 10 deletions include/fdeep/tensor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -991,16 +991,6 @@ inline tensor dot_product_tensors(
return output;
}

inline tensor subtract_tensor(const tensor& a, const tensor& b)
{
// todo: replace with subtract_tensors
assertion(a.shape() == b.shape(),
"both tensors must have the same size");
auto result_values = fplus::zip_with(std::minus<float_type>(),
*a.as_vector(), *b.as_vector());
return tensor(a.shape(), result_values);
}

inline tensor average_tensors(const tensors& ts)
{
const auto sum = sum_tensors(ts);
Expand Down

0 comments on commit 646c71d

Please sign in to comment.