Skip to content

Commit

Permalink
Replace LiteralUtil to Literal in compiler/plugin/executor
Browse files Browse the repository at this point in the history
  • Loading branch information
yifeif committed Jun 21, 2017
1 parent 62fb49d commit a54d43f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions tensorflow/compiler/plugin/executor/executable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static se::DeviceMemoryBase AllocateSingleOutput(sep::ExecutorExecutor* executor
const Literal& literal) {
int64 size(xla::ShapeUtil::ByteSizeOf(literal.shape()));
void* buf = executor->Allocate(size);
const void* src = LiteralUtil::InternalData(literal);
const void* src = Literal::InternalData(literal);
memcpy(buf, src, size);
return se::DeviceMemoryBase(buf, size);
}
Expand Down Expand Up @@ -86,11 +86,11 @@ StatusOr<se::DeviceMemoryBase> ExecutorExecutable::ExecuteOnStream(
for (int64 p = 0; p < computation->num_parameters(); p++) {
// Create the input literal for the parameter
HloInstruction* param = computation->parameter_instruction(p);
arg_literals.emplace_back(LiteralUtil::CreateFromShape(param->shape()));
arg_literals.emplace_back(Literal::CreateFromShape(param->shape()));
arg_literals_ptrs.push_back(arg_literals.back().get());

// Copy in the data from the stream_executor buffers
void* buffer = LiteralUtil::MutableInternalData(arg_literals.back().get());
void* buffer = Literal::MutableInternalData(arg_literals.back().get());
memcpy(buffer, arguments[p].opaque(),
ShapeUtil::ByteSizeOf(param->shape()));
}
Expand Down
8 changes: 4 additions & 4 deletions tensorflow/compiler/plugin/executor/transfer_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ Status ExecutorTransferManager::TransferLiteralFromDevice(
}

*literal->mutable_shape() = device_shape;
LiteralUtil::Reserve(ShapeUtil::ElementsIn(device_shape), literal);
Literal::Reserve(ShapeUtil::ElementsIn(device_shape), literal);
TF_RETURN_IF_ERROR(TransferBufferFromDevice(
executor, source, ShapeUtil::ByteSizeOf(device_shape),
LiteralUtil::MutableInternalData(literal)));
Literal::MutableInternalData(literal)));
if (!ShapeUtil::Equal(literal_shape, device_shape)) {
literal->Swap(
LiteralUtil::Relayout(*literal, literal_shape.layout()).get());
Literal::Relayout(*literal, literal_shape.layout()).get());
}
TF_RET_CHECK(ShapeUtil::Equal(literal_shape, literal->shape()));
return Status::OK();
Expand Down Expand Up @@ -134,7 +134,7 @@ Status ExecutorTransferManager::TransferLiteralToDevice(
}

return TransferBufferToDevice(executor, GetByteSizeRequirement(shape),
LiteralUtil::InternalData(literal),
Literal::InternalData(literal),
destination);
}

Expand Down

0 comments on commit a54d43f

Please sign in to comment.