Help Center> Huawei HiLens> User Guide> TensorFlow Operator Boundaries
Updated on 2022-08-19 GMT+08:00

TensorFlow Operator Boundaries

Table 1 shows the boundaries of TensorFlow operators supported by .om models.

Table 1 TensorFlow operator boundaries

No.

Python API

C++ API

Boundary

1

tf.nn.avg_pool

AvgPool

Type: Mean

[Parameter]

  • value: 4D tensor of type float32, with shape [batch, height, width, channels]
  • ksize: list or tuple of four integers, each value corresponding to the window size for each dimension of the input tensor.
  • strides: list or tuple of four integers. Each value corresponding to the stride of the sliding window for each dimension of the input tensor.
  • padding: string, either VALID or SAME
  • data_format: string, either NHWC (default) or NCHW
  • name: (optional) string

[Constraint]

  • kernelH ≤ inputH + padTop + padBottom
  • kernelW ≤ inputW + padLeft + padRight
  • padTop < windowH
  • padBottom < windowH
  • padLeft < windowW
  • padRight < windowW

In addition to common restrictions, the following restrictions must be satisfied.

The global pooling mode supports only the following scenarios:
  • outputH == 1 && outputW == 1 && kernelH ≥ inputH && kernelW ≥ inputW
  • inputH*inputW ≤ 10,000

[Output]

Tensor of the identical data type as value

[Quantitative tool support]

Yes

2

tf.nn.max_pool

MaxPool

Same as tf.nn.avg_pool

3

tf.nn.conv2d

Conv2D

[Parameter]

  • value: 4D tensor, with shape [batch, height, width, channels]
  • Data type: float32
  • filter: constant tensor, with same data type and dimensions as value, with shape [filter_height, filter_width, in_channels, out_channels]
  • strides: non-null list or tuple of four integers, each value corresponding to the stride of the sliding window for each dimension of the input tensor
  • padding: non-null string, either VALID or SAME
  • use_cudnn_on_gpu: bool, default to True
  • data_format: non-null string, either NHWC (default) or NCHW
  • dilations: (optional) list of four integers, default to [1,1,1,1], each value corresponding to a dimension. If k > 1, k – 1 units are skipped at the corresponding dimension in filtering. The dimension sequence is determined by data_format. The values of batch and depth of dilations must be 1.
  • name: (optional) string

[Constraint]

  • (inputW + padWHead + padWTail) ≥ (((FilterW-1) x dilationW) + 1)
  • (inputW + padWHead + padWTail)/StrideW + 1 ≤ INT32_MAX
  • (inputH + padHHead + padHTail) ≥ (((FilterH-1) x dilationH) + 1)
  • (inputH + padHHead + padHTail)/StrideH + 1 ≤ INT32_MAX
  • 0 ≤ Pad < 256, 0 < FilterSize < 256, 0 < Stride < 64, 1 ≤ dilationsize < 256

[Output]

Tensor of the identical data type as value

[Quantitative tool support]

Yes

4

tf.concat

Concat

[Parameter]

  • values: list of tensor objects or a single tensor. The values of dimensions must be the same except the dimensions to be concatenated.
  • axis: 0D tensor of type int32, specifying the dimension to be concatenated. The value range is [–rank(values), rank(values)]. As in Python, indexing for axis is 0-based. Positive axis in the range [0, rank(values)) refers to axis-th dimension, while negative axis refers to [axis + rank(values)]-th dimension.

[Constraint]

For the input tensor, the sizes of its dimensions must be the same except the dimension for concatenation.

The range of the input tensor count is [1, 1000].

[Output]

Tensor, resulting from concatenation of the input tensors

[Quantitative tool support]

Yes

5

tf.matmul

MatMul

[Parameter]

  • a: non-constant tensor of type float32, rank ≥ 2
  • b: constant tensor with the same data type and rank as a
  • transpose_a: The value true indicates that a is transposed before multiplication.
  • transpose_b: The value true indicates that b is transposed before multiplication. If transpose_a is false, transpose_b is also false.
  • adjoint_a: The value true indicates that a is conjugated and transposed before multiplication.
  • adjoint_b: The value true indicates that b is conjugated and transposed before multiplication.
  • a_is_sparse: The value true indicates that a is treated as a sparse matrix.
  • b_is_sparse: The value true indicates that b is treated as a sparse matrix.
  • name: optional

[Constraint]

  • The transposing property of weight is false.
  • The multiplication of two tensors is not supported. Only one tensor by one constant is supported.

[Output]

Tensor of the identical data type as a and b

[Quantitative tool support]

No

6

tf.nn.fused_batch_norm

FusedBatchNorm

[Parameter]

  • x: 4D tensor of type float32
  • scale: 1D tensor for scaling
  • offset: 1D tensor for bias
  • mean: 1D tensor for population mean used for inference
  • variance: 1D tensor for population variance used for inference
  • epsilon: small float number added to the variance of x
  • data_format: data format for x, either NHWC (default) or NCHW
  • is_training: bool, specifying whether the operation is used for training or inference
  • name: (optional) operation name

[Constraint]

shape of scale, bias, mean, and var: (1, C, 1, 1), with the C dimensions equal to that of the input

[Output]

  • y: 4D tensor for the normalized, scaled, offset x
  • batch_mean: 1D tensor for the mean of x
  • batch_var: 1D Tensor for the variance of x

[Quantitative tool support]

No

7

tf.abs

Abs

[Parameter]

  • x: tensor or sparse tensor of type float32
  • name: (optional) operation name

[Constraint]

None

[Output]

Returns the absolute value of x, tensor or sparse tensor. The size and type are the same as those of x.

[Quantitative tool support]

Yes

8

tf.image.resize_nearest_neighbor

ResizeNearestNeighbor

[Parameter]

  • images: 4D tensor of type float32, with shape [batch, height, width, channels] or 3D tensor of type float32 with shape [height, width, channels]
  • size: 1D 2-element constant tensor, indicating the new size for the images
  • method: ResizeMethod.NEARESTNEIGHBOR
  • align_corners: bool, default to False. The value True indicates that the centers of the 4 corner pixels of the input and output tensors are aligned and the values at the corner pixels are preserved.

[Constraint]

None

[Output]

Tensor of type float, with the identical shape as the input

[Quantitative tool support]

No

9

tf.image.resize_bilinear

ResizeBilinear

[Parameter]

  • images: 4D non-constant tensor of type float32, with shape [batch, height, width, channels]
  • size: 1D 2-element constant tensor, indicating the new size for the images
  • method: ResizeMethod.BILINEAR
  • align_corners: bool, default to False. The value True indicates that the centers of the 4 corner pixels of the input and output tensors are aligned and the values at the corner pixels are preserved.

[Constraint]

(outputH x outputW)/(inputH x inputW) > 1/7

[Output]

Tensor of type float, with the identical shape as the input

[Quantitative tool support]

No

10

tf.cast

Cast

[Input]

Type: float32, int32, bool, int64, int16, int8, uint8, uint16, double

[Parameter]

  • x: Tensor, SparseTensor, or IndexedSlices
  • dtype: destination type, same as the data type of x
  • name: optional

[Constraint]

None

[Output]

Tensor, SparseTensor, or IndexedSlices with the same dtype and shape as the input

[Quantitative tool support]

No

11

tf.nn.depthwise_conv2d

DepthwiseConv2dNative

[Parameter]

  • input: 4D
  • filter: 4D constant, with shape [filter_height, filter_width, in_channels, channel_multiplier]
  • strides: non-null list of four integers, each value corresponding to the stride of the sliding window for each dimension of the input tensor
  • padding: string, either VALID or SAME
  • rate: 1D of size 2. The dilation rate in which we sample input values across the height and width dimensions in atrous convolution. If i\t is greater than 1, then all values of strides must be 1.
  • data_format: data format for input, either NHWC (default) or NCHW
  • name: optional

[Constraint]

filterN = inputC = group

[Output]

4D tensor, with shape according to data_format. For example, for format NHWC, shape = [batch, out_height, out_width, in_channels * channel_multiplier]

[Quantitative tool support]

Yes

12

tf.reshape

Reshape

[Parameter]

  • tensor: 1 tensor input
  • shape: constant tensor of type int64 or int, indicating the output shape
  • name: (optional) operation name

[Constraint]

None

[Output]

Tensor of the identical data type as input

[Quantitative tool support]

Yes

13

tf.squeeze

Squeeze

[Parameter]

  • input: non-constant tensor
  • axis: list of ints, specifying the dimensions to be squeezed, default to []. It is an error to squeeze a dimension that is not 1.
  • name: (optional) operation name
  • squeeze_dims: (deprecated) exclusive with axis

[Constraint]

None

[Output]

Tensor, with the same data and type as input, but has one or more dimensions of size 1 removed.

[Quantitative tool support]

Yes

14

tf.expand_dims

ExpandDims

[Parameter]

  • inuput: 1 tensor input
  • axis: 0D (scalar), specifying the dimension index of the extended input shape
  • name: name of the output tensor
  • dim: 0D (scalar), equivalent to axis (deprecated)

[Constraint]

None

[Output]

Tensor with the same data as input, but its shape has an additional dimension of size 1 added

[Quantitative tool support]

Yes

15

tf.greater

Greater

[Parameter]

  • x: 1 tensor input
  • y: scalar
  • name: (optional) operation name

[Constraint]

Broadcasting is supported, so the shape of x and shape of y are compared. For a right-aligned dimension, if the values of xdim[i] and ydim[i] are not the same, one of them must be 1 or missing.

[Output]

Tensor of type bool

[Quantitative tool support]

No

16

tf.nn.relu

Relu

[Parameter]

  • features: non-constant tensor
  • name: (optional) operation name

[Constraint]

None

[Output]

Tensor of the identical data type as features

[Quantitative tool support]

Yes

17

tf.nn.relu6

Relu6

[Parameter]

  • features: non-constant tensor
  • name: (optional) operation name

[Constraint]

None

[Output]

Tensor of the identical data type as features

[Quantitative tool support]

Yes

18

tf.nn.leaky_relu

/

[Parameter]

  • features: non-constant tensor representing pre-activation values
  • alpha: slope of the activation function at x < 0
  • name: (optional) operation name

[Constraint]

None

[Output]

Activation value

[Quantitative tool support]

Yes

19

tf.exp

exp

[Parameter]

  • x: tensor of type float32 or double
  • name: (optional) operation name

[Constraint]

None

[Output]

Tensor of the identical data type as x

[Quantitative tool support]

No

20

tf.nn.conv2d_transpose

Conv2DBackpropInput

[Parameter]

  • value: 4D tensor with shape [batch, height, width, in_channels] for NHWC data format or [batch, in_channel, height, width] for NCHW data format
  • filter: 4D constant tensor with shape [height, width, output_channels, in_channels]
  • output_shape: 1D tensor, indicating the output shape
  • strides: non-null list of integers, each value corresponding to the stride of the sliding window for each dimension of the input tensor
  • padding: non-null string, either VALID or SAME
  • data_format: non-null string, either NHWC or NCHW
  • name: (optional) output name

[Constraint]

  • group = 1
  • dilation = 1
  • filterH - padHHead - 1 ≥ 0
  • filterW - padWHead - 1 ≥ 0

Restrictions involving intermediate variables:

  1. a = ALIGN(filter_num, 16) x ALIGN(filter_c, 16) x filter_h x filter_w x 2
  2. If ALIGN(filter_c, 16)%32 = 0, a = a/2
  3. conv_input_width = (deconvolution input W – 1) x strideW + 1
  4. b = (conv_input_width) x filter_h x ALIGN(filter_num, 16) x 2 x 2
  5. a + b <= 1024*1024

[Output]

Tensor of the identical data type as value

[Quantitative tool support]

Yes

21

tf.sigmoid

Sigmoid

[Parameter]

  • x: 1 tensor input
  • name: (optional) operation name

[Constraint]

None

[Output]

Tensor of the identical data type as value

[Quantitative tool support]

Yes

22

tf.add

Add

[Parameter]

  • x: Tensor of type float32 or int32
  • y: Tensor of the identical data type as x. For two constant inputs, one of them is a scalar.
  • name: (optional) operation name

[Constraint]

If the two inputs have inconsistent dimensions, broadcasting (that is, dimension padding) is performed.

Broadcasting is supported in the following scenarios:

  • NHWC + NHWC, NHWC + scalar
  • NHWC + 1 1 1 1
  • NHWC + W, HWC + W, HW + W (W-based broadcasting)
  • NCHW + NH1C, HWC + H1C, HW + H1
  • HWC + 1 WC (H-based broadcasting)
NOTE:

The input sequence of the two tensors is not fixed.

[Output]

Tensor of the identical data type as y

[Quantitative tool support]

Yes

23

tf.multiply

Multiply

Type: Mul

[Parameter]

  • x: Tensor of type float32 or int32
  • y: Tensor of the identical data type as x. If two constants are input, their dimensions must be identical (scalar or 1D tensor)
  • name: (optional) operation name

[Constraint]

If the two inputs have inconsistent dimensions, broadcasting (that is, dimension padding) is performed.

Broadcasting is supported in the following scenarios:

  • NHWC + NHWC, NHWC + scalar
  • NHWC + 1 1 1 1
  • NHWC + W, HWC + W, HW + W (W-based broadcasting)
  • NCHW + NH1C, HWC + H1C, HW + H1
  • HWC + 1 WC (H-based broadcasting)
NOTE:

The input sequence of the two tensors is not fixed.

[Output]

1 tensor

[Quantitative tool support]

Yes

24

tf.subtract

Subtract

Type: Sub

[Parameter]

  • x: 1 tensor input
  • y: Tensor of the identical data type as x, constant or non-constant
  • name: (optional) operation name

[Constraint]

If the two inputs have inconsistent dimensions, broadcasting (that is, dimension padding) is performed.

Broadcasting is supported in the following scenarios:

  • NHWC + NHWC, NHWC + scalar
  • NHWC + 1 1 1 1
  • NHWC + W, HWC + W, HW + W (W-based broadcasting)
  • NCHW + NH1C, HWC + H1C, HW + H1
  • HWC + 1 WC (H-based broadcasting)
NOTE:

The input sequence of the two tensors is not fixed.

[Output]

1 tensor

[Quantitative tool support]

Yes

25

tf.nn.bias_add

BiasAdd

[Parameter]

  • value: non-constant tensor
  • bias: 1D constant tensor, with size matching the last dimension of value, of the same type as value unless value is a quantized type
  • data_format: string, either NHWC or NCHW
  • name: (optional) operation name

[Constraint]

  • C < 10,000
  • input and bias must have the same data layout.
  • When bias is added to the C dimension, the C dimensions of input and bias must of the same size.

[Output]

Tensor of the identical data type as value

[Quantitative tool support]

Yes

26

tf.nn.lrn

LRN

[Parameter]

  • input: 4D tensor of type float32
  • depth_radius: 0D of type int, default to 5, indicating the half-width of the 1D normalization window
  • bias: (optional) float, default to 1, indicating the offset (usually positive to avoid dividing by 0)
  • alpha: (optional) float, default to 1, indicating the scale factor, usually positive
  • beta: (optional) float, default to 0.5, indicating an exponent
  • name: (optional) operation name

[Constraint]

  • depth_radius is an odd number greater than 0.
  • Inter-channel:

    When depth_radius is within [1,15], alpha > 0.00001 and beta > 0.01; Otherwise, alpha and beta are of any values. When C > 1,776, depth_radius < 1,728.

[Output]

Tensor of the identical data type as input

[Quantitative tool support]

Yes

27

tf.nn.elu

Elu

[Parameter]

  • features: non-constant tensor
  • name: optional

[Constraint]

None

[Output]

Tensor of the identical data type as features

[Quantitative tool support]

No

28

tf.rsqrt

Rsqrt

[Parameter]

  • x: tensor input
  • name: optional

[Constraint]

None

[Output]

Tensor of the identical data type as x

[Quantitative tool support]

Yes

29

tf.log

Log

[Parameter]

  • x: Tensor of type float32
  • name: optional

[Constraint]

None

[Output]

Tensor of the identical data type as x

[Quantitative tool support]

No

30

tf.tanh

Tanh

[Parameter]

  • x: non-constant tensor
  • name: optional

[Constraint]

None

[Output]

Tensor of the identical data type as x

[Quantitative tool support]

Yes

31

tf.slice

Slice

[Parameter]

  • input_: tensor input
  • begin: tensor of type int32 or int64
  • size: Tensor of type int32 or int64
  • name: optional

[Constraint]

The number of tensor elements cannot exceed INT32_MAX.

[Output]

Tensor of the identical data type as input_

[Quantitative tool support]

Yes

32

tf.split

Split

[Parameter]

  • value: tensor input
  • num_or_size_splits: not supported
  • axis: integer, specifying the dimension along which to split
  • name: (optional), string

[Constraint]

None

[Output]

List of tensor objects resulting from splitting

[Quantitative tool support]

Yes

33

tf.nn.softplus

Softplus

[Parameter]

  • features: Tensor of type float32
  • name: (optional), string

[Constraint]

None

[Output]

Tensor of the identical data type as features

[Quantitative tool support]

No

34

tf.nn.softsign

Softsign

[Parameter]

  • features: Tensor of type float32
  • name: (optional), string

[Constraint]

None

[Output]

Tensor of the identical data type as features

[Quantitative tool support]

No

35

tf.pad

Excessive CPU usage usually means insufficient idle CPUs in the system.

[Parameter]

  • tensor: 4D tensor of type float32 and int32
  • paddings: constant tensor of type int32
  • mode: string, CONSTANT, REFLECT, or SYMMETRIC
  • name: (optional), string
  • constant_values: scalar pad value to use, of the identical data type as tensor.

[Constraint]

In CONSTANT mode: 0 ≤ PAD ≤ 128, 0 < W ≤ 3000

[Output]

Tensor of the identical data type as tensor

[Quantitative tool support]

Yes

36

tf.fake_quant_with_min_max_vars

FakeQuantWithMinMaxVars

[Parameter]

  • inputs: Tensor of type float32
  • min: tensor of type float32
  • max: tensor of type float32
  • num_bits: scalar of type int, default to 8
  • narrow_range: (optional) bool, default to False
  • name: (optional), string

[Constraint]

-65,504 ≤ min ≤ 65,504, -65,504 ≤ max ≤ 65,504

[Output]

Tensor of type float32

[Quantitative tool support]

No

37

tf.reduce_max

Max

[Parameter]

  • input_tensor: Tensor, must be one of the following types: float32, int64, int32, uint8, uint16, int16, int8
  • axis: 1D list or scalar of type integer
  • keepdims: bool, indicating whether to retain reduced dimensions with length 1
  • name: (optional), string
  • reduction_indices: (deprecated) equivalent to axis
  • keep_dims: (deprecated) equivalent to keepdims

[Constraint]

  • When the input tensor has four dimensions: input axis = {3,{1,2,3}}, keepDims = true, H * W * 16 * 2 ≤ 16 * 1024
  • When the input tensor has two dimensions: input axis = {1,{1}}, keepDims = true, H * W * CEIL(C, 16) * 16 * 2 ≤ 16 * 1024

[Output]

Reduced Tensor of the identical data type as input_tensor

[Quantitative tool support]

No

38

tf.strided_slice

StridedSlice

[Parameter]

  • input: 1 tensor
  • begin: 1D tensor of type int32
  • end: 1D tensor of type int32
  • strides: 1D tensor of type int32
  • begin_mask: scalar of type int32
  • end_mask: scalar of type int32
  • ellipsis_mask: scalar of type int32
  • new_axis_mask: scalar of type int32
  • new_axis_mask: scalar of type int32
  • var: variable corresponding to input_ or None
  • name: (optional), string

[Constraint]

strides ≠ 0

[Output]

Tensor of the identical data type as input_

[Quantitative tool support]

No

39

tf.reverse

Reverse

[Parameter]

  • tensor: list of tensor objects
  • axis: int32 or int64, indicating the dimensions to reverse
  • name: (optional), string

[Constraint]

None

[Output]

Tensor of the identical data type as tensor

[Quantitative tool support]

No

40

tf.realdiv

RealDiv

[Parameter]

  • x: Tensor of type float32
  • y: Tensor of type float32
  • name: (optional), string

[Constraint]

None

[Output]

Tensor of the identical data type as x

[Quantitative tool support]

Yes

41

tf.stack

Stack

[Parameter]

  • values: list of tensor objects with the same shape and type (float32 or int32)
  • axis: (mandatory) integer, indicating the axis to stack along, default to the first dimension
  • name: optional

[Constraint]

None

[Output]

Stacked tensor of the identical data type as values

Mandatory attributes: T, N, and axis

[Quantitative tool support]

No

42

tf.unstack

Unpack

[Parameter]

  • value: tensor (rank > 0) to be unstacked, of type float32 or int32
  • num: integer, indicating the length of the dimension axis, default to None
  • axis: (mandatory) integer, indicating the axis to unstack along, default to the first dimension
  • name: optional

[Constraint]

None

[Output]

List of tensor objects unstacked from value

[Quantitative tool support]

No

43

tf.transpose

Transpose

[Parameter]

  • a: tensor input
  • perm: permutation of the dimensions of a
  • name: optional
  • conjugate: (optional) bool, default to False. Setting it to True is mathematically equivalent to tf.conj(tf.transpose(input))

[Constraint]

None

[Output]

Resulting tensor after transposition

[Quantitative tool support]

Yes

44

tf.space_to_batch_nd

SpaceToBatchND

[Parameter]

  • input: ND tensor with shape input_shape = [batch] + spatial_shape + remaining_shape, where spatial_shape has M dimensions. The following data types are supported: uint8, int8, int16, uint16, int32, int64, and float32
  • block_shape: 1D Tensor of type int32 or int64, with shape [M]. All values must be ≥ 1.
  • paddings: 2D tensor of type int32 or int64, with shape [M, 2]. All values must be ≥ 0.

[Constraint]

When the tensor rank is 4:

The length of blockShape must be 2, and the length of paddings must be 4.

  • Element value of blockShape ≥ 1; Element value of paddings ≥ 0
  • The padded H dimension is a multiple of blockShape[0], and the padded W dimension is a multiple of blockShape[1].

[Output]

Tensor of the identical data type as input

[Quantitative tool support]

No

45

tf.batch_to_space_nd

BatchToSpaceND

[Parameter]

  • input: ND tensor with shape input_shape = [batch] + spatial_shape + remaining_shape, where spatial_shape has M dimensions. The following data types are supported: uint8, int8, int16, uint16, int32, int64, and float32
  • block_shape: 1D Tensor of type int32 or int64, with shape [M]. All values must be ≥ 1.
  • crops: 2D tensor of type int32 or int64, with shape [M, 2]. All values must be ≥ 0.

[Constraint]

  • The element data type of blockShape and crops must be int32. When the dimension count of the tensor is 4, the length of blockShape must be 2, and the length of crops must be 4.
  • Element value of blockShape ≥ 1; Element value of crops ≥ 0; for the crops array: crop_start[i] + crop_end[i] < block_shape[i] * input_shape[i+1]

[Output]

Tensor of the identical data type as images

[Quantitative tool support]

No

46

tf.extract_image_patches

ExtractImagePatches

[Parameter]

  • images: 4D tensor with shape [batch, in_rows, in_cols, depth], must be one of the following types: float32, int32, int64, uint8, int8, uint16, and int16
  • ksizes: list of ints with length ≥ 4
  • strides: list of ints, must be [1, stride_rows, stride_cols, 1]
  • rate: list of ints, must be [1, rate_rows, rate_cols, 1]
  • padding: string, either VALID or SAME. VALID indicates that the selected patch area must be completely included in the source image. SAME indicates that the part that exceeds the source image is padded with 0.
  • name: optional

[Constraint]

None

[Output]

Tensor of the identical data type as images

[Quantitative tool support]

No

47

tf.floormod

FloorMod

[Parameter]

  • x: Tensor of type float32 or int32
  • y: Tensor of the identical data type as x
  • name: optional

[Constraint]

Broadcasting is supported, so the shape of x and shape of y are compared. For a right-aligned dimension, if the values of xdim[i] and ydim[i] are not the same, one of them must be 1 or missing.

[Output]

Tensor of the identical data type as x

[Quantitative tool support]

No

48

tf.nn.softmax

Softmax

[Parameter]

  • logits: non-null Tensor of type float32
  • axis: dimension softmax to be performed on, default to –1, indicating the last dimension. The value cannot be greater than the rank of logits.
  • name: optional
  • dim: (deprecated) equivalent to axis

[Constraint]

  • Softmax can be performed on each of the four input dimensions.

    According to axis:

    When axis = 1: C ≤ ((256 x 1024/4) – 8 x 1024 – 256)/2

    When axis = 0: n ≤ (56 x 1024 – 256)/2

    When axis = 2: W = 1, 0 < h < (1024 x 1024/32)

    When axis = 3: 0 < W < (1024 x 1024/32)

  • If the input contains fewer than four dimensions, softmax is performed only on the last dimension, with the last dimension ≤ 46,080.

[Output]

Tensor of the identical type and shape as logits

[Quantitative tool support]

Yes

49

tf.math.pow

Power

[Parameter]

  • x: Tensor of type float32
  • y: Tensor of type float32
  • name: optional

[Constraint]

power! = 1

scale*x + shift > 0

[Output]

1 tensor

[Quantitative tool support]

Yes

50

tf.placeholder

-

[Parameter]

  • dype: (mandatory) data type
  • shape: (mandatory) shape of the tensor to be fed

[Constraint]

None

[Output]

1 tensor

[Quantitative tool support]

No

51

tf.shape

Shape

[Parameter]

  • input: Tensor or SparseTensor
  • name: (optional), string
  • out_type: data type for the output tensor, either int32 (default) or int64

[Constraint]

None

[Output]

Tensor of the data type specified by out_type

[Quantitative tool support]

No

52

tf.math.argmax

ArgMax

[Parameter]

  • input: Tensor, must be one of the following types: int8, uint8, int16, uint16, int32, int64, float32
  • axis: 1 tensor of type: int32 or int64
  • out_type: data type for the output tensor, either int32 or int64 (default)
  • name: (optional), string

[Constraint]

None

[Output]

Tensor of the data type specified by out_type

[Quantitative tool support]

No

53

tf.gather

Gather

GatherV2

[Parameter]

  • params: 1 tensor, must be at least rank axis + 1
  • indices: tensor of type int32 or int64, must be in range [0, params.shape[axis])
  • axis: output tensor of type int32 or int64, specifying the axis in params to gather indices from, rank = 0
  • name: (optional), string

[Constraint]

None

[Output]

Tensor of the identical data type as params

[Quantitative tool support]

No

54

tf.gather_nd

GatherNd

[Parameter]

  • params: 1 tensor, must be at least rank axis + 1
  • indices: 1 tensor of type: int32 or int64
  • name: (optional), string

[Constraint]

  • indices: The last dimension of indices can be at most the rank of params.
  • The elements in the last dimension of indices correspond to the coordinates along a dimension of params. Therefore, the coordinate rules must be met.
  • The coordinates of the corresponding dimension in the indices cannot exceed the dimension size.

[Output]

Tensor of the identical data type as params

[Quantitative tool support]

Yes

55

tf.math.floordiv

FloorDiv

[Parameter]

  • x: Tensor of type float32 or int32
  • y: Tensor, denominator of type float32 or int32
  • name: (optional), string

[Constraint]

Broadcasting is supported, so the shape of x and shape of y are compared. For a right-aligned dimension, if the values of xdim[i] and ydim[i] are not the same, one of them must be 1 or missing.

[Output]

Tensor, floor (x/y)

[Quantitative tool support]

No

56

tf.range

Range

[Parameter]

  • start: start constant scalar of type float32 or int32
  • limit: end constant scalar of type float32 or int32
  • delta: stride constant scalar of type float32 or int32
  • dtype: data type of the resulting tensor
  • name: (optional), string

[Constraint]

None

[Output]

1 1D tensor

[Quantitative tool support]

No

57

tf.tile

Tile

[Parameter]

  • input: Tensor, must be one of the following types:

    int8, uint8, int16, uint16, int32, int64, float32

  • multiples: 1D constant tensor of type int32. The length must be the same as that of input.
  • name: (optional), string

[Constraint]

None

[Output]

1 tensor

[Quantitative tool support]

Yes

58

tf.size

Size

[Parameter]

  • input: tensor of type float32
  • name: (optional), string
  • out_type: data type for the output tensor, default to int32

[Constraint]

None

[Output]

Tensor of the data type specified by out_type

[Quantitative tool support]

No

59

tf.fill

Fill

[Parameter]

  • dims: 1D tensor of type int32
  • value: variable of type int32 or float32
  • name: (optional), string

[Constraint]

The following padding modes are supported: Constant, GivenTensor, Range, Diagonal, Gaussian, MSRA, Uniform, UniformInt, UniqueUniform, and XavierFill. When the Uniform, UniformInt, UniqueUniform, and xavier padding modes are used, the value range of the generated value is [min, max).

[Output]

Tensor of the identical data type as value

[Quantitative tool support]

No

60

tf.concat

Concat

[Parameter]

  • value: list of tensor objects of type int32 or float32
  • axis: int32, indicating the dimensions to concatenate
  • name: (optional), string

[Constraint]

For the input tensor, the sizes of its dimensions must be the same except the dimension for concatenation.

The range of the input tensor count is [1, 1000].

[Output]

1 tensor

[Quantitative tool support]

Yes

61

tf.reverse

Reverse

[Parameter]

  • tensor: list of tensor objects
  • axis: int32, indicating the dimensions to reverse
  • name: (optional), string

[Constraint]

None

[Output]

Tensor of the identical data type as tensor

[Quantitative tool support]

No

62

tf. reduce_sum

sum

[Parameter]

  • input_tensor: tensor input
  • axis: int32, indicating the dimensions to sum up
  • keepdims: bool, indicating whether to retain reduced dimensions
  • name: (optional), string
  • reduction_indices: (deprecated) string, equivalent to axis
  • keep_dims: deprecated alias for keepdims

[Constraint]

None

[Output]

Tensor of the identical data type as tensor

[Quantitative tool support]

No

63

tf. math.maximum

Maximum

[Parameter]

  • max: tensor, must be one of the following types: int32, int64, float32
  • y: tensor of the identical data type as x
  • name: (optional), string

[Constraint]

Broadcasting is supported, so the shape of x and shape of y are compared. For a right-aligned dimension, if the values of xdim[i] and ydim[i] are not the same, one of them must be 1 or missing.

[Output]

Tensor. Returns the max of x and y (x < y ? x:y)

Identical data type as x

[Quantitative tool support]

No

64

tf. math.minimum

Minimum

[Parameter]

  • max: tensor, must be one of the following types: int32, int64, float32
  • y: tensor of the identical data type as x
  • name: optional

[Constraint]

Broadcasting is supported in the following two scenarios:

NHWC + scaler, NHWC + NHWC

[Output]

Tensor. Returns the max of x and y (x < y ? x:y)

Identical data type as x

[Quantitative tool support]

No

65

tf.clip_by_value

ClipByValue

[Parameter]

  • t: Tensor
  • clip_value_min: minimum value to clip by
  • clip_value_max: maximum value to clip by
  • name: (optional), string

[Constraint]

The minimum value must be less than or equal to the maximum value.

[Output]

Clipped tensor. The return value range is [clip_value_min, clip_value_max].

[Quantitative tool support]

No

66

tf.math.logical_not

LogicalNot

[Parameter]

  • x: tensor of type bool
  • name: (optional), string

[Constraint]

None

[Output]

Tensor of type bool

[Quantitative tool support]

No

67

tf.math.logical_and

LogicalAnd

[Parameter]

  • x: tensor of type bool
  • y: tensor of type bool
  • name: (optional), string

[Constraint]

Broadcasting is supported in the following dimension scenarios: NHWC and [1,1,1,1], [N,H,W,C], [N,H,W,1], [1,H,W,C], [N,1,1,C]

[Output]

Tensor of type bool

[Quantitative tool support]

No

68

tf.equal

Equal

[Parameter]

  • x: Tensor
  • y: tensor of the identical data type as x
  • name: (optional), string

[Constraint]

Broadcasting is supported, so shape of x and shape of y are compared. For a right-aligned dimension, the values of xdim[i] and ydim[i] are the same. If not, one of them must be 1 or missing.

[Output]

Tensor of type bool

[Quantitative tool support]

No

69

tf.square

Square

[Parameter]

  • x: Tensor
  • name: (optional), string

[Constraint]

None

[Output]

Tensor of the identical data type as x

[Quantitative tool support]

No

70

tf.image.crop_and_resize

CropAndResize

[Parameter]

  • image: 4D tensor, must be one of the following types: float32, int8, int32, int64, with shape [num_boxes, 4]
  • boxes: 2D tensor of type float32, with shape [num_boxes]
  • box_ind: 1D tensor of type int32
  • crop_size: 1D 2-element tensor of type int32
  • method: string, indicating the interpolation method, either bilinear (default) or nearest
  • name: (optional), string

[Constraint]

None

[Output]

Tensor of type float32

[Quantitative tool support]

No

71

tf.math.top_k

TopKV2

[Parameter]

  • input: 1D tensor or higher with the last dimension at least k, of type float32 (k: scalar of type int32, ≥ 1)
  • sorted: bool
  • name: (optional), string

[Constraint]

k must be a constant.

[Output]

  • values: tensor, indicating k largest elements along each last dimensional slice
  • indices: tensor, indicating the indices of values of input

    [Quantitative tool support]

    No

72

tf.invert_permutation

InvertPermutation

[Parameter]

  • x: 1D tensor of type int32 or int64
  • name: (optional), string

[Constraint]

None

[Output]

Tensor of the identical data type as x

[Quantitative tool support]

No

73

tf.multinomial

Multinomial

[Parameter]

  • logits: 2D tensor, with shape [batch_size, num_classes]
  • num_samples: scalar, indicating the number of samples to draw
  • seed: int32 or int64, used to create a random seed
  • name: (optional), string
  • output_dtype: integer, data type for the output tensor, default to int64

[Constraint]

When seed is 0, the generated random is dynamic.

Number of rows in the output data = Number of rows in the output data; Number of columns in the output data = num_samples

[Output]

Tensor of the data type specified by output_dtype

[Quantitative tool support]

No

74

tf.reverse_sequence

ReverseSequence

[Parameter]

  • input: tensor input
  • seq_lengths: 1D tensor of type int32 or int64
  • seq_axis: scalar of type integer
  • batch_axis: scalar of type integer
  • name: (optional), string

[Constraint]

  • The length of seq_lengths must be equal to the number of elements of input in batchAxis.
  • The maximum element in seq_lengths must be less than or equal to the number of elements in seq_dim.
  • seqAxis, batchAxis, seqDim, and batchDim must be of type int64.
  • seqAxis and seqDim are exclusive. batchAxis and batchDim are exclusive.
  • batchAxis and batchDim are optional. The default values are 0.

[Output]

Tensor of the data type specified by input

[Quantitative tool support]

No

75

tf.math.reciprocal

Reciprocal

[Parameter]

  • x: Tensor of type float32
  • name: (optional), string

[Constraint]

The input data cannot contain 0.

[Output]

Tensor of the identical data type as x

[Quantitative tool support]

No

76

tf.nn.selu

Selu

[Parameter]

  • features: Tensor of type float32
  • name: (optional), string

[Constraint]

None

[Output]

Tensor of the identical data type as features

[Quantitative tool support]

No

77

tf.math.acosh

Acosh

[Parameter]

  • x: Tensor of type float32
  • name: (optional), string

[Constraint]

None

[Output]

Tensor of the identical data type as x

[Quantitative tool support]

No

78

tf.math.asinh

Asinh

[Parameter]

  • x: Tensor of type float32
  • name: (optional), string

[Constraint]

None

[Output]

Tensor of the identical data type as x

[Quantitative tool support]

No

79

tf.math.reduce_prod

Prod

[Parameter]

  • input_tensor: tensor input
  • axis: dimension to reduce
  • keepdims: bool, indicating whether to retain reduced dimensions
  • name: (optional), string
  • reduction_indices: (deprecated) equivalent to axis
  • keep_dims: (deprecated) equivalent to keepdims

[Constraint]

None

[Output]

Tensor and reduced tensor

[Quantitative tool support]

No

80

tf.math.sqrt

Sqrt

[Parameter]

  • x: Tensor of type float32
  • name: (optional), string

[Constraint]

None

[Output]

Tensor of the identical data type as x

[Quantitative tool support]

No

81

tf.math.reduce_all

All

[Parameter]

  • input_tensor: tensor of type bool
  • axis: dimension to reduce
  • keepdims: bool
  • name: (optional), string
  • reduction_indices: (deprecated) equivalent to axis
  • keep_dims: (deprecated) equivalent to keepdims

[Constraint]

None

[Output]

Tensor of the identical data type as input_tensor

[Quantitative tool support]

No

82

tf.nn.l2_normalize

L2Normalize

[Parameter]

  • x: Tensor of type boolean
  • axis: dimension along which to normalize
    • For format NCHW, axis must be set to 1.
    • For format NHWC, axis must be set to 3.
  • epsilon: lower bound value for the norm. If norm < sqrt(epsilon), sqrt(epsilon) is used as the divisor.
  • name: (optional), string
  • dim: (deprecated) equivalent to axis

[Constraint]

H*W*2 < 256*1024/4

[Output]

Tensor of the identical data type as x

[Quantitative tool support]

No

83

tf.keras.backend.hard_sigmoid

Hardsigmoid

[Parameter]

x: tensor input

[Constraint]

None

[Output]

Output Tensor. If x < –2.5, 0 is returned. If x > 2.5, 1 is returned.

If -2.5 ≤ x ≤ 2.5, 0.2 * x + 0.5 is returned.

[Quantitative tool support]

No

84

tf.keras.layers.ThresholdedReLU

ThresholdedReLU

[Parameter]

theta: scalar of type float32, ≥ 0

[Constraint]

None

[Output]

Tensor

[Quantitative tool support]

No

85

tf.math.acos

Acos

[Parameter]

x: Tensor of type float32, int32, or int64

name: (optional), string

[Constraint]

The input data range is (–1 ≤ x ≤ 1), and the output data range is (0 ≤ y ≤ π).

[Output]

Tensor of the identical data type as x

[Quantitative tool support]

No

86

tf.math.atan

Arctan

[Parameter]

x: Tensor of type float32, int32, or int64

name: (optional), string

[Constraint]

The input data range is (-65504 ≤ x ≤ 65504), and the output data range is (-π/2 ≤ y ≤ π/2).

[Output]

Tensor of the identical data type as x

[Quantitative tool support]

No

87

tf.math.asin

Asin

[Parameter]

  • x: Tensor of type float32, int32, or int64
  • name: (optional), string

[Constraint]

The input data range is (–1 ≤ x ≤ 1), and the output data range is (-π/2 ≤ y ≤ π/2).

[Output]

Tensor of the identical data type as x

[Quantitative tool support]

No

88

tf.math.atanh

Atanh

[Parameter]

  • x: Tensor of type float32, int32, or int64
  • name: (optional), string

[Constraint]

Input data range: x within (-1, 1)

[Output]

Tensor of the identical data type as x

[Quantitative tool support]

No

89

tf.math.tan

Tan

[Parameter]

  • x: Tensor of type float32, int32, or int64
  • name: (optional), string

[Constraint]

None

[Output]

Tensor of the identical data type as x

[Quantitative tool support]

No

90

tf.math.logical_or

LogicalOr

[Parameter]

  • x: Tensor of type bool
  • y: Tensor of type bool
  • name: (optional), string

[Constraint]

Broadcasting is supported, so shape of x and shape of y are compared. For a right-aligned dimension, the values of xdim[i] and ydim[i] are the same. If not, one of them must be 1 or missing.

[Output]

Tensor of type bool

[Quantitative tool support]

No

91

tf.math.reduce_min

ReduceMin

[Parameter]

  • input_tensor: Tensor, must be one of the following types: float32, int64, int32, uint8, uint16, int8, int16
  • axis: dimension to reduce
  • keepdims: scalar of type bool
  • name: (optional), string
  • reduction_indices: (deprecated) equivalent to axis
  • keep_dims: (deprecated) equivalent to keepdims

[Constraint]

  • When the input tensor has four dimensions: input axis = {3,{1,2,3}}, keepDims = true, H * W * 16 * 2 ≤ 16 * 1024
  • When the input tensor has two dimensions: input axis = {1,{1}}, keepDims = true, H * W * CEIL(C, 16) * 16 * 2 ≤ 16 * 1024

[Output]

Tensor of the identical data type as input_tensor

[Quantitative tool support]

No

92

tf.math.negative

Neg

[Parameter]

  • x: Tensor of type float32, int64, or int32
  • name: (optional), string

[Constraint]

The input data range is (-65504 ≤ x ≤ 65504), and the output data range is (-65504 ≤ y ≤ 65504).

[Output]

Tensor. Returns –x.

[Quantitative tool support]

No

93

tf.math.greater_equal

Greaterequal

[Parameter]

  • x: Tensor, must be one of the following types: float32, int64, int32, uint8, uint16, int8, int16
  • y: tensor of the identical data type as x
  • name: (optional), string

[Constraint]

The input data range is (-65504 ≤ x ≤ 65504)

[Output]

Tensor of type bool

[Quantitative tool support]

No

94

tf.space_to_depth

SpaceToDepth

[Parameter]

  • input: tensor, must be one of the following types: float32, int64, int32, uint8, int8
  • block_size: scalar of type integer, ≥ 2
  • data_format: string, must be NHWC (default), NCHW, or NCHW_VECT_C
  • name: (optional), string

[Constraint]

blockSize ≥ 1 and blockSize must be a divisor of both the input height and width.

[Output]

Tensor of the identical data type as input

[Quantitative tool support]

No

95

tf.depth_to_space

DepthToSpace

[Parameter]

  • input: tensor, must be one of the following types: float32, int64, int32, uint8, int8
  • block_size: scalar of type integer, ≥ 2
  • data_format: string, must be NHWC (default), NCHW, or NCHW_VECT_C
  • name: (optional), string

[Constraint]

blockSize ≥ 1, and blockSize * blockSize must be exactly divided by C.

[Output]

Tensor of the identical data type as input

[Quantitative tool support]

No

96

tf.math.round

Round

[Parameter]

  • x: Tensor of type float32, int64, or int32
  • name: (optional), string

[Constraint]

None

[Output]

Tensor of the identical data type and shape as x

[Quantitative tool support]

No

97

tf.math.rint

Rint

[Parameter]

  • x: tensor, must be one of the following types: float32, int64, int32, uint8, int8
  • name: (optional), string

[Constraint]

None

[Output]

Tensor of the identical data type and shape as x

[Quantitative tool support]

No

98

tf.math.less

Less

[Parameter]

  • x: Tensor, must be one of the following types: float32, int64, int32, uint8, uint16, int8, int16
  • y: tensor of the identical data type as x
  • name: (optional), string

[Constraint]

None

[Output]

Tensor of type bool

[Quantitative tool support]

No

99

tf.math.sinh

Sinh

[Parameter]

  • x: Tensor of type float32
  • name: (optional), string

[Constraint]

None

[Output]

Tensor of the identical output type as x

[Quantitative tool support]

No

100

tf.math.cosh

Cosh

[Parameter]

  • x: Tensor of type float32
  • name: (optional), string

[Constraint]

None

[Output]

Tensor of the identical output type as x

[Quantitative tool support]

No

101

tf.math.squared_difference

Squared_difference

[Parameter]

  • x: Tensor of type float32, int64, or int32
  • y: tensor of the identical data type as x
  • name: (optional), string

[Constraint]

Broadcasting is supported only in the following scenarios:

One NCHW tensor and one tensor of the following format: dim{} = [1,1,1,1], [N,C,H,W], [N,1,H,W], [1,C,H,W], [N,C,1,1], [1,C,1,1], [1,1,H,W], or [N,1,1,1]

[Output]

Tensor of the identical data type as x

[Quantitative tool support]

No