Skip to content

Commit 44c9216

Browse files
Dobiasdclaude
andcommitted
Add iterator-pair tensor constructor (closes #415)
Allows constructing a tensor from any iterator range (raw pointers, std::span, container iterators) without first materializing a float_vec. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 7cbc07c commit 44c9216

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

include/fdeep/tensor.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ namespace internal {
4646
: tensor(shape, fplus::make_shared_ref<float_vec>(shape.volume(), value))
4747
{
4848
}
49+
template <typename It>
50+
tensor(const tensor_shape& shape, It first, It last)
51+
: tensor(shape, fplus::make_shared_ref<float_vec>(first, last))
52+
{
53+
}
4954
float_type get(const tensor_pos& pos) const
5055
{
5156
return (*values_)[idx(pos)];

0 commit comments

Comments
 (0)