Commit Graph

15 Commits

Author SHA1 Message Date
A. Unique TensorFlower
917ebfe5fc Add a HostToBorrowingLiteral function that takes an xla::Shape
PiperOrigin-RevId: 296514358
Change-Id: I5a69538960c064300baabe7ef2cd3c021f156bb1
2020-02-21 14:44:42 -08:00
Peter Hawkins
ee054e9826 [TF:XLA] Fix more int32/int64 literal bugs.
Make XlaOpKernelContext::ConstantInputReshaped private, and change its users to use other methods, since its use cases can be handled other ways.

Move code to copy a tensor to a literal into common literal_util module and simplify it.

PiperOrigin-RevId: 220502409
2018-11-07 11:56:40 -08:00
Tim Shen
736a471dc0 Change headers to directly include absl::Span, and clean up the build
dependencies as well.

PiperOrigin-RevId: 211038094
2018-08-30 22:52:05 -07:00
Tim Shen
6f879f891a [XLA] Rename all (Mutable)ArraySlice to absl::Span.
PiperOrigin-RevId: 210998142
2018-08-30 16:07:27 -07:00
Kay Zhu
963ef37203 [TF:XLA] Introduce MutableBorrowingLiteral to enable interacting with a (tensor) buffer not owned by XLA/Literal class directly, without having to memcpy the Literal to a (Host)Tensor.
PiperOrigin-RevId: 207972410
2018-08-08 17:24:39 -07:00
Kay Zhu
8779f768a3 [TF:XLA] Split literal_util into {literal, literal_util}.
Currently Literal classes sits in literal_util.{h,cc} instead of literal.{h,cc}.
It also contains helper functions that are better fit to be their own separate
class/namespace. This change starts this process by moving most static factory
methods to LiteralUtil namespace.

PiperOrigin-RevId: 203217065
2018-07-03 19:06:26 -07:00
Kay Zhu
3f46969e86 Automated g4 rollback of changelist 200777514
PiperOrigin-RevId: 201252470
2018-06-19 15:36:35 -07:00
Kay Zhu
33f8f7e184 Automated g4 rollback of changelist 200750664
PiperOrigin-RevId: 200777514
2018-06-15 14:52:33 -07:00
Kay Zhu
f9b832d91f [TF2XLA] Remove the last unncessary host-to-device memcpy, and remove the
HostTensorToLiteral function completely to prevent potential future misuse of
unnecessary memcpy.

PiperOrigin-RevId: 200750664
2018-06-15 11:59:29 -07:00
Kay Zhu
5174b67f70 [TF:XLA] Introduce a new HostTensorToBorrowingLiteral path without the memcpy from Tensor to Literal, and use it in xla_helpers.
PiperOrigin-RevId: 199682452
2018-06-07 13:06:34 -07:00
Kay Zhu
e1347ba769 [XLA] First step in adding Literal slice classes, to improve interface safety
and prepare for enabling more efficient interfacing from Tensor to Literal to
reduce host to device latency.

More specically:
* Introducing a new LiteralBase abstract base class that contains all immutable
methods of from the old Literal class.

* Introducing a subclass LiteralSlice to replace original LiteralView class.
LiteralSlice class is read-only and does not own Shape nor any buffer through
the Pieces. Change a number of callers to use LiteralSlice directly.

* Change Literal class to explicitly own the underlying Shape as well as owning
the underlying buffer via Piece.

* Conversion from Literal to LiteralSlice is now done via an implicit
conversion constructor instead of inheritance.

* Decouple ShapeTree from Literal classes.

* Use copy-and-swap for assignment constructors.

* Other minor cleanups.

PiperOrigin-RevId: 196016576
2018-05-09 13:47:51 -07:00
Peter Hawkins
aa92995493 [TF:XLA] Add a hook to allow reshaping of TensorFlow variables when storing them in their XLA representation.
PiperOrigin-RevId: 185748660
2018-02-14 14:53:40 -08:00
A. Unique TensorFlower
02ac85399d Introduce new class Literal to replace protobuf Literal.
This renames the existing Literal message to LiteralProto and introduces a new
C++ class named Literal to replace it.

The LiteralProto is only used at RPC boundaries, or when protobuf-specific
functionality is required.  The Literal class offers a 'ToProto' function to
generate a new LiteralProto message when necessary.

Currently, all the static functions in class LiteralUtil, just forward to their
counterparts in class Literal.  This will change in a future CL.

Class Literal implements all the buffers as std::vectors.  The only exception
is preds(), which given the std::vector<bool> representation, makes it unusable
for the semantics we require (it's not possible to get the address of the
underlying vector, for instance).

The CL adds a BoolVector class to work around that issue.

In future CLs, the std::vector representation may be changed to something more
efficient, if needed.

PiperOrigin-RevId: 157739125
2017-06-01 11:34:21 -07:00
Peter Hawkins
f424ca3871 [TF:XLA] Add implementation of tf.one_hot to the XLA bridge.
Fix crash in normal OneHot kernel for depth < 0.
Change: 148881102
2017-03-01 06:30:42 -08:00
Peter Hawkins
1e67c90e2c Initial open-source release of XLA: Accelerated Linear Algebra.
XLA is a compiler-based linear algebra execution engine that targets CPUs, GPUs and custom accelerators.

XLA is still experimental; we are releasing it early to get the community involved.
Change: 143990941
2017-01-09 12:26:35 -08:00