tensorflow/core/kernels/segment_reduction_ops_impl_1.cc
// Static routines not in the templated class to reduce code size
Static routines not in the templated class to reduce code size
Static routines not in the templated class to reduce code size
Status ValidateSegmentReduction(OpKernelContext* context, const Tensor& input,
                                const Tensor& segment_ids) {
  if (!TensorShapeUtils::IsVectorOrHigher(input.shape())) {
    return errors::InvalidArgument("input must be at least rank 1");
  }
  if (!TensorShapeUtils::IsVector(segment_ids.shape())) {
    return errors::InvalidArgument("segment_ids should be a vector.");
  }
  const int64_t num_indices = segment_ids.NumElements();
  if (num_indices != input.dim_size(0)) {
    return errors::InvalidArgument(
        "segment_ids should be the same size as dimension 0 of"
        " input.");
  }
  return Status::OK();
}
Status ValidateSegmentReduction ( OpKernelContext * context , const Tensor & input , const Tensor & segment_ids ) { if ( ! TensorShapeUtils :: IsVectorOrHigher ( input . shape ( ) ) ) { return errors :: InvalidArgument ( " " ) ; } if ( ! TensorShapeUtils :: IsVector ( segment_ids . shape ( ) ) ) { return errors :: InvalidArgument ( " " ) ; } const int64_t num_indices = segment_ids . NumElements ( ) ; if ( num_indices != input . dim_size ( 0 ) ) { return errors :: InvalidArgument ( " " " " ) ; } return Status :: OK ( ) ; }
Static routines not in the templated class to reduce code size
Static routines not in the templated class to reduce code size