function bandPart_(a, numLower, numUpper) {
	  assert(numLower % 1 === 0, function () {
	    return "bandPart(): numLower must be an integer, got " + numLower + ".";
	  });
	  assert(numUpper % 1 === 0, function () {
	    return "bandPart(): numUpper must be an integer, got " + numUpper + ".";
	  });
	  var $a = convertToTensor(a, 'a', 'bandPart');
	  assert($a.rank >= 2, function () {
	    return "bandPart(): Rank must be at least 2, got " + $a.rank + ".";
	  });
	  var shape = $a.shape;

	  var _$a$shape$slice = $a.shape.slice(-2),
	      M = _$a$shape$slice[0],
	      N = _$a$shape$slice[1];

	  if (!(numLower <= M)) {
	    throw new Error("bandPart(): numLower (" + numLower + ")" + (" must not be greater than the number of rows (" + M + ")."));
	  }

	  if (!(numUpper <= N)) {
	    throw new Error("bandPart(): numUpper (" + numUpper + ")" + (" must not be greater than the number of columns (" + N + ")."));
	  }

	  if (numLower < 0) {
	    numLower = M;
	  }

	  if (numUpper < 0) {
	    numUpper = N;
	  }

	  var i = reshape(range(0, M, 1, 'int32'), [-1, 1]);
	  var j = range(0, N, 1, 'int32');
	  var ij = sub(i, j);
	  var inBand = logicalAnd(lessEqual(ij, scalar(+numLower, 'int32')), greaterEqual(ij, scalar(-numUpper, 'int32')));
	  var zero = zeros([M, N], $a.dtype);
	  return reshape(stack(unstack(reshape($a, [-1, M, N])).map(function (mat) {
	    return where(inBand, mat, zero);
	  })), shape);
	}
Copy a tensor setting everything outside a central band in each innermost
matrix to zero.

The band part is computed as follows: Assume input has `k` dimensions
`[I, J, K, ..., M, N]`, then the output is a tensor with the same shape where
`band[i, j, k, ..., m, n] = in_band(m, n) * input[i, j, k, ..., m, n]`.
The indicator function
`in_band(m, n) = (num_lower < 0 || (m-n) <= num_lower))`
`&& (num_upper < 0 || (n-m) <= num_upper)`

```js
const x = tf.tensor2d([[ 0,  1,  2, 3],
                       [-1,  0,  1, 2],
                       [-2, -1,  0, 1],
                       [-3, -2, -1, 0]]);
let y = tf.linalg.bandPart(x, 1, -1);
y.print(); // [[ 0,  1,  2, 3],
           //  [-1,  0,  1, 2],
           //  [ 0, -1,  0, 1],
           //  [ 0, 0 , -1, 0]]
let z = tf.linalg.bandPart(x, 2, 1);
z.print(); // [[ 0,  1,  0, 0],
           //  [-1,  0,  1, 0],
           //  [-2, -1,  0, 1],
           //  [ 0, -2, -1, 0]]
```

@param x Rank `k` tensor
@param numLower Number of subdiagonals to keep.
  If negative, keep entire lower triangle.
@param numUpper Number of subdiagonals to keep.
  If negative, keep entire upper triangle.
@returns Rank `k` tensor of the same shape as input.
  The extracted banded tensor.

@doc {heading:'Operations', subheading:'Linear Algebra', namespace:'linalg'}