diff options
-rw-r--r-- | eval/src/vespa/eval/tensor/default_tensor_engine.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/eval/src/vespa/eval/tensor/default_tensor_engine.cpp b/eval/src/vespa/eval/tensor/default_tensor_engine.cpp index 2506e6fcf0e..dbca85744a3 100644 --- a/eval/src/vespa/eval/tensor/default_tensor_engine.cpp +++ b/eval/src/vespa/eval/tensor/default_tensor_engine.cpp @@ -12,6 +12,7 @@ #include <vespa/eval/eval/tensor_spec.h> #include <vespa/eval/eval/simple_tensor_engine.h> #include <vespa/eval/eval/operation.h> +#include <vespa/vespalib/objects/nbostream.h> #include <cassert> @@ -42,8 +43,9 @@ const Value &to_simple(const Value &value, Stash &stash) { if (auto wrapped = dynamic_cast<const WrappedSimpleTensor *>(tensor)) { return wrapped->get(); } - TensorSpec spec = tensor->engine().to_spec(*tensor); - return *stash.create<Value::UP>(eval::SimpleTensor::create(spec)); + nbostream data; + tensor->engine().encode(*tensor, data); + return *stash.create<Value::UP>(eval::SimpleTensor::decode(data)); } return value; } @@ -57,8 +59,9 @@ const Value &to_default(const Value &value, Stash &stash) { return stash.create<WrappedSimpleTensor>(*simple); } } - TensorSpec spec = tensor->engine().to_spec(*tensor); - return *stash.create<Value::UP>(default_engine().from_spec(spec)); + nbostream data; + tensor->engine().encode(*tensor, data); + return *stash.create<Value::UP>(default_engine().decode(data)); } return value; } |