tf.expand_dims()

Description

The function returns a tensor with a length 1 axis inserted at the index axis.

Given a tensor input, this operation inserts a dimension of length 1 at the dimension index axis of input‘s shape. The dimension index follows Python indexing rules: It’s zero-based, a negative index is counted backward from the end.

This operation is useful to:

  • Add an outer “batch” dimension to a single element.
  • Align axes for broadcasting.
  • To add an inner vector length axis to a tensor of scalars.

Import Libraries

####################imports####################
#do not change

import cv2
import numpy as np
import tensorflow as tf

#do not change
####################imports####################

Parameters

Example

It seems we can't find what you're looking for.
Table of Contents