Returns a tf.Tensor that has expanded rank, by inserting a dimension into the tensor's shape.
tf.Tensor
const x = tf.tensor1d([1, 2, 3, 4]);const axis = 1;x.expandDims(axis).print(); Copy
const x = tf.tensor1d([1, 2, 3, 4]);const axis = 1;x.expandDims(axis).print();
The input tensor whose dimensions are to be expanded.
Optional
The dimension index at which to insert shape of 1. Defaults to 0 (the first dimension).
1
Returns a
tf.Tensor
that has expanded rank, by inserting a dimension into the tensor's shape.