summaryrefslogtreecommitdiffstats
path: root/eval
diff options
context:
space:
mode:
authorHaavard <havardpe@yahoo-inc.com>2017-05-24 12:27:48 +0000
committerHaavard <havardpe@yahoo-inc.com>2017-05-24 12:27:48 +0000
commitc529b7de0a3c53a3d1e32af07de47604b876eb68 (patch)
treec5aa18f67686129b7a5246f622abcf539b0a3d8a /eval
parent330facf68ce39ad3fc4b74f11743bbd35cf24f26 (diff)
clone for wrapped tensors
Diffstat (limited to 'eval')
-rw-r--r--eval/src/vespa/eval/eval/simple_tensor.cpp2
-rw-r--r--eval/src/vespa/eval/eval/simple_tensor.h2
-rw-r--r--eval/src/vespa/eval/tensor/wrapped_simple_tensor.cpp14
-rw-r--r--eval/src/vespa/eval/tensor/wrapped_simple_tensor.h2
4 files changed, 10 insertions, 10 deletions
diff --git a/eval/src/vespa/eval/eval/simple_tensor.cpp b/eval/src/vespa/eval/eval/simple_tensor.cpp
index 20076d398d4..3752e15a26f 100644
--- a/eval/src/vespa/eval/eval/simple_tensor.cpp
+++ b/eval/src/vespa/eval/eval/simple_tensor.cpp
@@ -529,7 +529,7 @@ SimpleTensor::SimpleTensor(double value)
{
}
-SimpleTensor::SimpleTensor(const ValueType &type_in, Cells &&cells_in)
+SimpleTensor::SimpleTensor(const ValueType &type_in, Cells cells_in)
: Tensor(SimpleTensorEngine::ref()),
_type(type_in),
_cells(std::move(cells_in))
diff --git a/eval/src/vespa/eval/eval/simple_tensor.h b/eval/src/vespa/eval/eval/simple_tensor.h
index 51b34813456..1c279f312c1 100644
--- a/eval/src/vespa/eval/eval/simple_tensor.h
+++ b/eval/src/vespa/eval/eval/simple_tensor.h
@@ -77,7 +77,7 @@ private:
public:
SimpleTensor();
explicit SimpleTensor(double value);
- SimpleTensor(const ValueType &type_in, Cells &&cells_in);
+ SimpleTensor(const ValueType &type_in, Cells cells_in);
const ValueType &type() const { return _type; }
const Cells &cells() const { return _cells; }
std::unique_ptr<SimpleTensor> map(const std::function<double(double)> &function) const;
diff --git a/eval/src/vespa/eval/tensor/wrapped_simple_tensor.cpp b/eval/src/vespa/eval/tensor/wrapped_simple_tensor.cpp
index 212960f9af6..77cb517c063 100644
--- a/eval/src/vespa/eval/tensor/wrapped_simple_tensor.cpp
+++ b/eval/src/vespa/eval/tensor/wrapped_simple_tensor.cpp
@@ -63,6 +63,13 @@ WrappedSimpleTensor::print(std::ostream &out) const
out << toString();
}
+Tensor::UP
+WrappedSimpleTensor::clone() const
+{
+ auto tensor = std::make_unique<eval::SimpleTensor>(_tensor.type(), _tensor.cells());
+ return std::make_unique<WrappedSimpleTensor>(std::move(tensor));
+}
+
//-----------------------------------------------------------------------------
Tensor::UP
@@ -135,11 +142,4 @@ WrappedSimpleTensor::reduce(const eval::BinaryOperation &, const std::vector<ves
return Tensor::UP();
}
-Tensor::UP
-WrappedSimpleTensor::clone() const
-{
- abort();
- return Tensor::UP();
-}
-
} // namespace vespalib::tensor
diff --git a/eval/src/vespa/eval/tensor/wrapped_simple_tensor.h b/eval/src/vespa/eval/tensor/wrapped_simple_tensor.h
index 6de501438ed..1f6c22254df 100644
--- a/eval/src/vespa/eval/tensor/wrapped_simple_tensor.h
+++ b/eval/src/vespa/eval/tensor/wrapped_simple_tensor.h
@@ -35,6 +35,7 @@ public:
double sum() const override;
void accept(TensorVisitor &visitor) const override;
void print(std::ostream &out) const override;
+ Tensor::UP clone() const override;
// functions below should not be used for this implementation
Tensor::UP add(const Tensor &) const override;
Tensor::UP subtract(const Tensor &) const override;
@@ -46,7 +47,6 @@ public:
Tensor::UP sum(const vespalib::string &) const override;
Tensor::UP apply(const eval::BinaryOperation &, const Tensor &) const override;
Tensor::UP reduce(const eval::BinaryOperation &, const std::vector<vespalib::string> &) const override;
- Tensor::UP clone() const override;
};
} // namespace vespalib::tensor