diff options
author | Zongheng Yang <zongheng.y@gmail.com> | 2016-05-05 11:15:43 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2016-05-05 12:20:43 -0700 |
commit | 923fca54685ca2af704d92442bae6cce944c3a1c (patch) | |
tree | a5fc6fed34e03e7447fef4e8e21de3c81bef9497 /tensorflow/core/util/bcast.h | |
parent | d6970c313a0add29252fb2e4f1e7e9461f739530 (diff) |
Introduce common cwise code for "sparse <op> dense"; use for cdiv, cmul.
Currently it supports broadcasting the dense side to the sparse side only.
Change: 121602996
Diffstat (limited to 'tensorflow/core/util/bcast.h')
-rw-r--r-- | tensorflow/core/util/bcast.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tensorflow/core/util/bcast.h b/tensorflow/core/util/bcast.h index 45584bb37f..6c4d320fce 100644 --- a/tensorflow/core/util/bcast.h +++ b/tensorflow/core/util/bcast.h @@ -105,6 +105,15 @@ class BCast { static Vec FromShape(const TensorShape& shape); static TensorShape ToShape(const BCast::Vec& vec); + template <int NDIMS> + static Eigen::array<Eigen::DenseIndex, NDIMS> ToIndexArray( + const BCast::Vec& vec) { + CHECK_EQ(vec.size(), NDIMS); + Eigen::array<Eigen::DenseIndex, NDIMS> ret; + for (int i = 0; i < NDIMS; ++i) ret[i] = vec[i]; + return ret; + } + private: bool valid_ = true; Vec x_reshape_; |