summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2020-12-09 14:23:56 +0000
committerArne Juul <arnej@verizonmedia.com>2020-12-09 14:23:56 +0000
commit7224be54ed47e44f285bb1d5cafdf12d78d45933 (patch)
treeb558dae9a5f735d44afbd503ae1a7c1006abbc9a
parentf37787e1510bd073748fdc0d0b991a22cc909ff0 (diff)
GC leftovers
-rw-r--r--eval/src/vespa/eval/tensor/dense/dense_tensor.cpp76
-rw-r--r--eval/src/vespa/eval/tensor/dense/typed_dense_tensor_builder.cpp46
-rw-r--r--eval/src/vespa/eval/tensor/dense/typed_dense_tensor_builder.h41
3 files changed, 0 insertions, 163 deletions
diff --git a/eval/src/vespa/eval/tensor/dense/dense_tensor.cpp b/eval/src/vespa/eval/tensor/dense/dense_tensor.cpp
deleted file mode 100644
index 26f9194c8ce..00000000000
--- a/eval/src/vespa/eval/tensor/dense/dense_tensor.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#include "dense_tensor.h"
-#include <vespa/vespalib/util/stringfmt.h>
-#include <vespa/vespalib/util/exceptions.h>
-
-using vespalib::eval::TensorSpec;
-
-namespace vespalib::tensor {
-
-namespace {
-
-size_t
-calcCellsSize(const eval::ValueType &type)
-{
- size_t cellsSize = 1;
- for (const auto &dim : type.dimensions()) {
- cellsSize *= dim.size;
- }
- return cellsSize;
-}
-
-template<typename T>
-void
-checkCellsSize(const DenseTensor<T> &arg)
-{
- auto cellsSize = calcCellsSize(arg.fast_type());
- if (arg.cells().size != cellsSize) {
- throw IllegalStateException(make_string("Wrong cell size, "
- "expected=%zu, "
- "actual=%zu",
- cellsSize,
- arg.cells().size));
- }
- if (arg.fast_type().cell_type() != arg.cells().type) {
- throw IllegalStateException(make_string("Wrong cell type, "
- "expected=%u, "
- "actual=%u",
- (unsigned char)arg.fast_type().cell_type(),
- (unsigned char)arg.cells().type));
- }
-}
-
-}
-
-template <typename CT>
-DenseTensor<CT>::DenseTensor(eval::ValueType type_in,
- std::vector<CT> &&cells_in)
- : DenseTensorView(_type),
- _type(std::move(type_in)),
- _cells(std::move(cells_in))
-{
- initCellsRef(TypedCells(_cells));
- checkCellsSize(*this);
-}
-
-template <typename CT>
-DenseTensor<CT>::~DenseTensor() = default;
-
-template <typename CT>
-template <typename RCT>
-bool
-DenseTensor<CT>::operator==(const DenseTensor<RCT> &rhs) const
-{
- if (_type != rhs._type) return false;
- if (_cells.size != rhs._cells.size) return false;
- for (size_t i = 0; i < _cells.size; i++) {
- if (_cells[i] != rhs._cells[i]) return false;
- }
- return true;
-}
-
-template class DenseTensor<float>;
-template class DenseTensor<double>;
-
-}
diff --git a/eval/src/vespa/eval/tensor/dense/typed_dense_tensor_builder.cpp b/eval/src/vespa/eval/tensor/dense/typed_dense_tensor_builder.cpp
deleted file mode 100644
index 385da6d1fcd..00000000000
--- a/eval/src/vespa/eval/tensor/dense/typed_dense_tensor_builder.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-
-#include "typed_dense_tensor_builder.h"
-
-namespace vespalib::tensor {
-
-using Address = DenseTensorView::Address;
-using eval::ValueType;
-
-namespace {
-
-size_t
-calculateCellsSize(const ValueType &type)
-{
- size_t cellsSize = 1;
- for (const auto &dim : type.dimensions()) {
- cellsSize *= dim.size;
- }
- return cellsSize;
-}
-
-} // namespace
-
-template <typename CT>
-TypedDenseTensorBuilder<CT>::~TypedDenseTensorBuilder() = default;
-
-template <typename CT>
-TypedDenseTensorBuilder<CT>::TypedDenseTensorBuilder(const ValueType &type_in)
- : _type(type_in),
- _cells(calculateCellsSize(_type))
-{
- assert(vespalib::eval::check_cell_type<CT>(_type.cell_type()));
-}
-
-template <typename CT>
-Tensor::UP
-TypedDenseTensorBuilder<CT>::build()
-{
- return std::make_unique<DenseTensor<CT>>(std::move(_type), std::move(_cells));
-}
-
-template class TypedDenseTensorBuilder<double>;
-template class TypedDenseTensorBuilder<float>;
-
-} // namespace
diff --git a/eval/src/vespa/eval/tensor/dense/typed_dense_tensor_builder.h b/eval/src/vespa/eval/tensor/dense/typed_dense_tensor_builder.h
deleted file mode 100644
index 770ea4ae5ea..00000000000
--- a/eval/src/vespa/eval/tensor/dense/typed_dense_tensor_builder.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#pragma once
-
-#include "dense_tensor.h"
-
-namespace vespalib::tensor {
-
-/**
- * Class for building a dense tensor by inserting cell values directly into underlying array of cells.
- */
-template <typename CT>
-class TypedDenseTensorBuilder
-{
-public:
- using Address = DenseTensorView::Address;
-private:
- eval::ValueType _type;
- std::vector<CT> _cells;
-
- static size_t calculateCellAddress(const Address &address, const eval::ValueType &type) {
- size_t result = 0;
- for (size_t i = 0; i < address.size(); ++i) {
- result *= type.dimensions()[i].size;
- result += address[i];
- }
- return result;
- }
-public:
- TypedDenseTensorBuilder(const eval::ValueType &type_in);
- ~TypedDenseTensorBuilder();
- void insertCell(const Address &address, CT cellValue) {
- insertCell(calculateCellAddress(address, _type), cellValue);
- }
- void insertCell(size_t index, CT cellValue) {
- _cells[index] = cellValue;
- }
- Tensor::UP build();
-};
-
-}