message: Verify dimensions before we assume we have at least 2 (i.e. before we end up calling dim_size with a negative dim index). This fixes tensorflow/python/kernel_tests:svd_op_test_gpu when running with asan.
diff: @@ -343,9 +343,6 @@ class SvdOpGpu : public AsyncOpKernel {
  void ComputeAsync(OpKernelContext* context, DoneCallback done) final {
  const Tensor& input = context->input(0);
  const int ndims = input.dims();
  - const int64 m = input.dim_size(ndims - 2);
  - const int64 n = input.dim_size(ndims - 1);
  - const int64 p = std::min(m, n);
  // Validate inputs.
  OP_REQUIRES_ASYNC(
  @@ -353,6 +350,10 @@ class SvdOpGpu : public AsyncOpKernel {
  errors::InvalidArgument("Input must have rank >= 2, got ", ndims),
  done);
  + const int64 m = input.dim_size(ndims - 2);
  + const int64 n = input.dim_size(ndims - 1);
  + const int64 p = std::min(m, n);
  +
  // output tensors.
  Tensor* outputU = NULL;
  Tensor* outputS = NULL;
  