diff options
author | 2018-05-25 17:46:19 -0700 | |
---|---|---|
committer | 2018-05-25 17:48:50 -0700 | |
commit | b4423efd55c5e463dd70d6975aa3a9d0f260011b (patch) | |
tree | 44b03f53e867a1732224d2e65a37075b2ed742d5 /tensorflow/compiler/xla/literal_util.h | |
parent | a6eb244b2b8ee4d9592a705c4bc0771e4d708565 (diff) |
Add a type-erased broadcast implementation to xla::Literal
And use this in HLO evaluator. Since broadcast only moves bytes around we don't
need a type specialized implementation.
I'll use this in a later change.
PiperOrigin-RevId: 198128524
Diffstat (limited to 'tensorflow/compiler/xla/literal_util.h')
-rw-r--r-- | tensorflow/compiler/xla/literal_util.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tensorflow/compiler/xla/literal_util.h b/tensorflow/compiler/xla/literal_util.h index 609dc7a3ac..2ca9060cc7 100644 --- a/tensorflow/compiler/xla/literal_util.h +++ b/tensorflow/compiler/xla/literal_util.h @@ -277,6 +277,12 @@ class LiteralBase { StatusOr<std::unique_ptr<Literal>> Reshape( tensorflow::gtl::ArraySlice<int64> dimensions) const; + // Creates a new literal by broadcasting this literal with `dimensions` to + // yield a literal of shape `result_shape`. + StatusOr<std::unique_ptr<Literal>> Broadcast( + const Shape& result_shape, + tensorflow::gtl::ArraySlice<int64> dimensions) const; + // Creates a new literal by reordering the dimensions of this literal. // The given `permutation` must be a permutation of the dimension numbers // in the original literal, and it specifies the order of the new dimensions |