| 164 | } |
| 165 | |
| 166 | StatusOr<Literal> Client::ExecuteAndTransfer( |
| 167 | const XlaComputation& computation, absl::Span<GlobalData* const> arguments, |
| 168 | const ExecutionOptions* execution_options, |
| 169 | ExecutionProfile* execution_profile) { |
| 170 | TF_ASSIGN_OR_RETURN( |
| 171 | std::unique_ptr<GlobalData> data, |
| 172 | Execute(computation, arguments, execution_options, execution_profile)); |
| 173 | |
| 174 | absl::optional<Shape> shape_with_output_layout; |
| 175 | if (execution_options && execution_options->has_shape_with_output_layout()) { |
| 176 | shape_with_output_layout = |
| 177 | Shape(execution_options->shape_with_output_layout()); |
| 178 | } |
| 179 | return Transfer(*data, shape_with_output_layout.has_value() |
| 180 | ? &(*shape_with_output_layout) |
| 181 | : nullptr); |
| 182 | } |
| 183 | |
| 184 | StatusOr<Literal> Client::ComputeConstant(const XlaComputation& computation, |
| 185 | const Layout* output_layout) const { |