blob: a9bc69c36c90e485d87003e8932264b41dc80cea (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "imported_tensor_attribute_vector_read_guard.h"
#include <vespa/searchlib/attribute/attributevector.h>
#include <vespa/eval/eval/value.h>
namespace search::tensor {
namespace {
const ITensorAttribute &
getTensorAttribute(const search::attribute::IAttributeVector &attr)
{
const ITensorAttribute *result = attr.asTensorAttribute();
assert(result != nullptr);
return *result;
}
}
ImportedTensorAttributeVectorReadGuard::ImportedTensorAttributeVectorReadGuard(std::shared_ptr<MetaStoreReadGuard> targetMetaStoreReadGuard,
const attribute::ImportedAttributeVector &imported_attribute,
bool stableEnumGuard)
: ImportedAttributeVectorReadGuard(std::move(targetMetaStoreReadGuard), imported_attribute, stableEnumGuard),
_target_tensor_attribute(getTensorAttribute(_target_attribute))
{
}
ImportedTensorAttributeVectorReadGuard::~ImportedTensorAttributeVectorReadGuard()
{
}
const ITensorAttribute *
ImportedTensorAttributeVectorReadGuard::asTensorAttribute() const
{
return this;
}
std::unique_ptr<vespalib::eval::Value>
ImportedTensorAttributeVectorReadGuard::getTensor(uint32_t docId) const
{
return _target_tensor_attribute.getTensor(getTargetLid(docId));
}
std::unique_ptr<vespalib::eval::Value>
ImportedTensorAttributeVectorReadGuard::getEmptyTensor() const
{
return _target_tensor_attribute.getEmptyTensor();
}
vespalib::eval::TypedCells
ImportedTensorAttributeVectorReadGuard::extract_cells_ref(uint32_t docid) const
{
return _target_tensor_attribute.extract_cells_ref(getTargetLid(docid));
}
const vespalib::eval::Value&
ImportedTensorAttributeVectorReadGuard::get_tensor_ref(uint32_t docid) const
{
return _target_tensor_attribute.get_tensor_ref(getTargetLid(docid));
}
const vespalib::eval::ValueType &
ImportedTensorAttributeVectorReadGuard::getTensorType() const
{
return _target_tensor_attribute.getTensorType();
}
void
ImportedTensorAttributeVectorReadGuard::get_state(const vespalib::slime::Inserter& inserter) const
{
_target_tensor_attribute.get_state(inserter);
}
}
|