diff options
author | Benjamin Kramer <kramerb@google.com> | 2017-09-14 08:04:42 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2017-09-14 08:08:57 -0700 |
commit | 0550f50bfd1b02687d517928b5a7ce776e8892fc (patch) | |
tree | 56bd88af0b12c9b29d63ac712c3ac86f88603408 /tensorflow/compiler/plugin | |
parent | 6d7c72f19c157fdcb13a7086eff5e92bec9c2bc2 (diff) |
[XLA] Remove Literal::Swap and replace all uses with moves.
This stems from the dark ages when Literal was an unmovable proto. Swap was
supposed to be fast (it moves) but in the conversion to a standalone class Swap
wasn't implemented properly and became a 3-way copy instead of a 3-way move.
All of the users want move anyways, so just remove Swap and use moves on all
call sites.
If actual swapping is needed, std::swap will work just fine for Literal, and
the default implementation is as fast as 3 moves.
PiperOrigin-RevId: 168689138
Diffstat (limited to 'tensorflow/compiler/plugin')
-rw-r--r-- | tensorflow/compiler/plugin/executor/transfer_manager.cc | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/tensorflow/compiler/plugin/executor/transfer_manager.cc b/tensorflow/compiler/plugin/executor/transfer_manager.cc index 51c5deeea5..32d6a0c04d 100644 --- a/tensorflow/compiler/plugin/executor/transfer_manager.cc +++ b/tensorflow/compiler/plugin/executor/transfer_manager.cc @@ -75,8 +75,7 @@ Status ExecutorTransferManager::TransferLiteralFromDevice( executor, source, ShapeUtil::ByteSizeOf(device_shape), literal->MutableInternalData())); if (!ShapeUtil::Equal(literal_shape, device_shape)) { - literal->Swap( - literal->Relayout(literal_shape.layout()).get()); + *literal = std::move(*literal->Relayout(literal_shape.layout())); } TF_RET_CHECK(ShapeUtil::Equal(literal_shape, literal->shape())); return Status::OK(); |