aboutsummaryrefslogtreecommitdiffstats
path: root/eval/src/tests/instruction/generic_cell_cast
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2021-02-26 15:19:34 +0000
committerArne Juul <arnej@verizonmedia.com>2021-02-26 15:19:34 +0000
commit5e80e8c2320e828dce9feac8bee9cc6a39b07586 (patch)
treedae3f5aa4e1d08b3dba6be010074fcdb461a2ca5 /eval/src/tests/instruction/generic_cell_cast
parentb386637b9bd6f3492acdda67c3eb4d00c1b357f0 (diff)
changes after review
* add ValueType::cell_cast which computes the canonical result type when applying a cast operator. For now, only allow double as scalar. * slight change to make_instruction; add the cell type as an extra parameter and require consistency (future-proofing). * In reference implementation, copy values via a temporary of the appropriate type, ensuring that casts may lose precision like they should.
Diffstat (limited to 'eval/src/tests/instruction/generic_cell_cast')
-rw-r--r--eval/src/tests/instruction/generic_cell_cast/generic_cell_cast_test.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/eval/src/tests/instruction/generic_cell_cast/generic_cell_cast_test.cpp b/eval/src/tests/instruction/generic_cell_cast/generic_cell_cast_test.cpp
index 26dd9737fe1..09596301fab 100644
--- a/eval/src/tests/instruction/generic_cell_cast/generic_cell_cast_test.cpp
+++ b/eval/src/tests/instruction/generic_cell_cast/generic_cell_cast_test.cpp
@@ -37,8 +37,8 @@ TensorSpec perform_generic_cell_cast(const TensorSpec &a, CellType to, const Val
{
Stash stash;
auto lhs = value_from_spec(a, factory);
- auto res_type = ValueType::make_type(to, lhs->type().dimensions());
- auto my_op = GenericCellCast::make_instruction(res_type, lhs->type(), stash);
+ auto res_type = ValueType::cell_cast(lhs->type(), to);
+ auto my_op = GenericCellCast::make_instruction(res_type, lhs->type(), res_type.cell_type(), stash);
InterpretedFunction::EvalSingle single(factory, my_op);
return spec_from_value(single.eval(std::vector<Value::CREF>({*lhs})));
}