Rename tensorflow::Reshape() to tensorflow::ReshapeSparseTensor().

This makes CPU profiles slightly more readable, because the generic `tensorflow::Reshape()` doesn't give a clue to the fact that it involves (components of) a `SparseTensor`.

PiperOrigin-RevId: 305508551
Change-Id: Idc4af3650a4bc77b394101890b2722d314f9aa9a
This commit is contained in:
Derek Murray 2020-04-08 10:44:23 -07:00 committed by TensorFlower Gardener
parent 3acb43588d
commit dd95f74f9a
4 changed files with 17 additions and 13 deletions

View File

@ -204,8 +204,9 @@ class DeserializeSparseOp : public OpKernel {
target_shape.vec<int64>()(i + ndims - 1) = output.shape().data()[i + 1];
}
Reshape(context, output.indices(), input_shape, target_shape,
0 /* output indices index */, 2 /* output shape index */);
ReshapeSparseTensor(context, output.indices(), input_shape, target_shape,
0 /* output indices index */,
2 /* output shape index */);
context->set_output(1, output.values());
}

View File

@ -31,9 +31,11 @@ limitations under the License.
namespace tensorflow {
void Reshape(OpKernelContext *context, const Tensor &input_indices_in,
const Tensor &input_shape_in, const Tensor &target_shape_in,
int output_indices_idx, int output_shape_idx) {
void ReshapeSparseTensor(OpKernelContext *context,
const Tensor &input_indices_in,
const Tensor &input_shape_in,
const Tensor &target_shape_in, int output_indices_idx,
int output_shape_idx) {
OP_REQUIRES(context, TensorShapeUtils::IsMatrix(input_indices_in.shape()),
errors::InvalidArgument(
"Input indices should be a matrix but received shape ",

View File

@ -16,17 +16,17 @@ limitations under the License.
#ifndef TENSORFLOW_CORE_KERNELS_RESHAPE_UTIL_H_
#define TENSORFLOW_CORE_KERNELS_RESHAPE_UTIL_H_
#include "tensorflow/core/framework/tensor.h"
#include "tensorflow/core/lib/core/status.h"
namespace tensorflow {
class OpKernelContext;
class Tensor;
// Reshapes the input indices and input shape to the target shape.
void Reshape(OpKernelContext *context, const Tensor &input_indices_in,
const Tensor &input_shape_in, const Tensor &target_shape_in,
int output_indices_idx, int output_shape_idx);
void ReshapeSparseTensor(OpKernelContext *context,
const Tensor &input_indices_in,
const Tensor &input_shape_in,
const Tensor &target_shape_in, int output_indices_idx,
int output_shape_idx);
} // namespace tensorflow

View File

@ -34,8 +34,9 @@ class SparseReshapeOp : public OpKernel {
explicit SparseReshapeOp(OpKernelConstruction* context) : OpKernel(context) {}
void Compute(OpKernelContext* context) override {
Reshape(context, context->input(0), context->input(1), context->input(2),
0 /* output indices index */, 1 /* output shape index */);
ReshapeSparseTensor(context, context->input(0), context->input(1),
context->input(2), 0 /* output indices index */,
1 /* output shape index */);
}
};