Help protect the Great Barrier Reef with TensorFlow on Kaggle Join Challenge

'tf' Dialect

The TensorFlow dialect.

This dialect maps to TensorFlow operations.

Invariants:

  • All values are of Tensor type (in particular, scalars are represented using zero-dimensional tensors);

TODO: Make invariants more structured so that we can reference them in ops.

Operation definition

tf.Abs (::mlir::TF::AbsOp)

Computes the absolute value of a tensor.

Given a tensor x, this operation returns a tensor containing the absolute value of each element in x. For example, if x is an input element and y is an output element, this operation computes \(y = |x|\).

Traits: Idempotent, SameOperandsAndResultType

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of bfloat16 or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer values

Results:

Result Description
y tensor of bfloat16 or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer values

tf.Acos (::mlir::TF::AcosOp)

Computes acos of x element-wise.

Provided an input tensor, the tf.math.acos operation returns the inverse cosine of each element of the tensor. If y = tf.math.cos(x) then, x = tf.math.acos(y).

Input range is [-1, 1] and the output has a range of [0, pi].

Traits: TF_SameOperandsAndResultTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer values

Results:

Result Description
y tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer values

tf.Acosh (::mlir::TF::AcoshOp)

Computes inverse hyperbolic cosine of x element-wise.

Given an input tensor, the function computes inverse hyperbolic cosine of every element. Input range is [1, inf]. It returns nan if the input lies outside the range.

x = tf.constant([-2, -0.5, 1, 1.2, 200, 10000, float("inf")])
tf.math.acosh(x) ==> [nan nan 0. 0.62236255 5.9914584 9.903487 inf]

Traits: TF_SameOperandsAndResultTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of floating-point or complex values

Results:

Result Description
y tensor of floating-point or complex values

tf.AddN (::mlir::TF::AddNOp)

Add all input tensors element wise.

Inputs must be of same size and shape.

  x = [9, 7, 10]
  tf.math.add_n(x) ==> 26

Traits: Commutative

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
N ::mlir::Attribute derived attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
inputs tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer or variant values

Results:

Result Description
sum tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer or variant values

tf.Add (::mlir::TF::AddOp)

Returns x + y element-wise.

Given two input tensors, the tf.add operation computes the sum for every element in the tensor.

Both input and output have a range (-inf, inf).

Traits: ResultsBroadcastableShape, TF_LayoutAgnostic, TF_SameOperandsAndResultElementTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of floating-point or signed integer or complex or 8-bit unsigned integer or string values
y tensor of floating-point or signed integer or complex or 8-bit unsigned integer or string values

Results:

Result Description
z tensor of floating-point or signed integer or complex or 8-bit unsigned integer or string values

tf.AddV2 (::mlir::TF::AddV2Op)

Returns x + y element-wise.

Traits: Commutative, ResultsBroadcastableShape, TF_CwiseBinary, TF_LayoutAgnostic, TF_SameOperandsAndResultElementTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values
y tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

Results:

Result Description
z tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

tf.AdjustContrastv2 (::mlir::TF::AdjustContrastv2Op)

Adjust the contrast of one or more images.

images is a tensor of at least 3 dimensions. The last 3 dimensions are interpreted as [height, width, channels]. The other dimensions only represent a collection of images, such as [batch, height, width, channels].

Contrast is adjusted independently for each channel of each image.

For each channel, the Op first computes the mean of the image pixels in the channel and then adjusts each component of each pixel to (x - mean) * contrast_factor + mean.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
images tensor of 16-bit float or 32-bit float values
contrast_factor tensor of 32-bit float values

Results:

Result Description
output tensor of 16-bit float or 32-bit float values

tf.AdjustHue (::mlir::TF::AdjustHueOp)

Adjust the hue of one or more images.

images is a tensor of at least 3 dimensions. The last dimension is interpreted as channels, and must be three.

The input image is considered in the RGB colorspace. Conceptually, the RGB colors are first mapped into HSV. A delta is then applied all the hue values, and then remapped back to RGB colorspace.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
images tensor of 16-bit float or 32-bit float values
delta tensor of 32-bit float values

Results:

Result Description
output tensor of 16-bit float or 32-bit float values

tf.AdjustSaturation (::mlir::TF::AdjustSaturationOp)

Adjust the saturation of one or more images.

images is a tensor of at least 3 dimensions. The last dimension is interpreted as channels, and must be three.

The input image is considered in the RGB colorspace. Conceptually, the RGB colors are first mapped into HSV. A scale is then applied all the saturation values, and then remapped back to RGB colorspace.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
images tensor of 16-bit float or 32-bit float values
scale tensor of 32-bit float values

Results:

Result Description
output tensor of 16-bit float or 32-bit float values

tf.All (::mlir::TF::AllOp)

Computes the "logical and" of elements across dimensions of a tensor.

Reduces input along the dimensions given in axis. Unless keep_dims is true, the rank of the tensor is reduced by 1 for each entry in axis. If keep_dims is true, the reduced dimensions are retained with length 1.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
keep_dims ::mlir::BoolAttr bool attribute
Tidx ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of bool values
reduction_indices tensor of 32/64-bit signed integer values

Results:

Result Description
output tensor of bool values

tf.AllToAll (::mlir::TF::AllToAllOp)

An Op to exchange data across TPU replicas.

On each replica, the input is split into split_count blocks along split_dimension and send to the other replicas given group_assignment. After receiving split_count - 1 blocks from other replicas, we concatenate the blocks along concat_dimension as the output.

For example, suppose there are 2 TPU replicas: replica 0 receives input: [[A, B]] replica 1 receives input: [[C, D]]

group_assignment=[[0, 1]] concat_dimension=0 split_dimension=1 split_count=2

replica 0's output: [[A], [C]] replica 1's output: [[B], [D]]

Traits: TF_NoConstantFold

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
concat_dimension ::mlir::IntegerAttr 64-bit signless integer attribute
split_dimension ::mlir::IntegerAttr 64-bit signless integer attribute
split_count ::mlir::IntegerAttr 64-bit signless integer attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of bfloat16 or bool or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values
group_assignment tensor of 32-bit integer values

Results:

Result Description
output tensor of bfloat16 or bool or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

tf.Angle (::mlir::TF::AngleOp)

Returns the argument of a complex number.

Given a tensor input of complex numbers, this operation returns a tensor of type float that is the argument of each element in input. All elements in input must be complex numbers of the form \(a + bj\), where a is the real part and b is the imaginary part.

The argument returned by this operation is of the form \(atan2(b, a)\).

For example:

# tensor 'input' is [-2.25 + 4.75j, 3.25 + 5.75j]
tf.angle(input) ==> [2.0132, 1.056]

@compatibility(numpy) Equivalent to np.angle. @end_compatibility

Traits: SameOperandsAndResultShape

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute
Tout ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of 128-bit complex or 64-bit complex values

Results:

Result Description
output tensor of 32/64-bit float values

tf.AnonymousIterator (::mlir::TF::AnonymousIteratorOp)

A container for an iterator resource.

Traits: TF::UniqueResourceAllocation

Interfaces: TF_ResourceHandleAllocatorInterface

Attributes:

Attribute MLIR Type Description
output_types ::mlir::ArrayAttr type array attribute with at least 1 elements
output_shapes ::mlir::ArrayAttr tensorflow shape attribute array with at least 1 elements

Results:

Result Description
handle tensor of resource values

tf.AnonymousIteratorV2 (::mlir::TF::AnonymousIteratorV2Op)

A container for an iterator resource.

Traits: TF::UniqueResourceAllocation

Interfaces: TF_ResourceHandleAllocatorInterface

Attributes:

Attribute MLIR Type Description
output_types ::mlir::ArrayAttr type array attribute with at least 1 elements
output_shapes ::mlir::ArrayAttr tensorflow shape attribute array with at least 1 elements

Results:

Result Description
handle tensor of resource values
deleter tensor of variant values

tf.AnonymousIteratorV3 (::mlir::TF::AnonymousIteratorV3Op)

A container for an iterator resource.

Traits: TF::UniqueResourceAllocation

Interfaces: TF_ResourceHandleAllocatorInterface

Attributes:

Attribute MLIR Type Description
output_types ::mlir::ArrayAttr type array attribute with at least 1 elements
output_shapes ::mlir::ArrayAttr tensorflow shape attribute array with at least 1 elements

Results:

Result Description
handle tensor of resource values

tf.AnonymousMemoryCache (::mlir::TF::AnonymousMemoryCacheOp)

Traits: TF::UniqueResourceAllocation

Interfaces: TF_ResourceHandleAllocatorInterface

Results:

Result Description
handle tensor of resource values
deleter tensor of variant values

tf.AnonymousMultiDeviceIterator (::mlir::TF::AnonymousMultiDeviceIteratorOp)

A container for a multi device iterator resource.

Traits: TF::UniqueResourceAllocation

Interfaces: TF_ResourceHandleAllocatorInterface

Attributes:

Attribute MLIR Type Description
devices ::mlir::ArrayAttr string array attribute with at least 1 elements
output_types ::mlir::ArrayAttr type array attribute with at least 1 elements
output_shapes ::mlir::ArrayAttr tensorflow shape attribute array with at least 1 elements

Results:

Result Description
handle tensor of resource values
deleter tensor of variant values

tf.AnonymousRandomSeedGenerator (::mlir::TF::AnonymousRandomSeedGeneratorOp)

Traits: TF::UniqueResourceAllocation

Interfaces: TF_ResourceHandleAllocatorInterface

Operands:

Operand Description
seed tensor of 64-bit integer values
seed2 tensor of 64-bit integer values

Results:

Result Description
handle tensor of resource values
deleter tensor of variant values

tf.AnonymousSeedGenerator (::mlir::TF::AnonymousSeedGeneratorOp)

Traits: TF::UniqueResourceAllocation

Interfaces: TF_ResourceHandleAllocatorInterface

Operands:

Operand Description
seed tensor of 64-bit integer values
seed2 tensor of 64-bit integer values
reshuffle tensor of bool values

Results:

Result Description
handle tensor of resource values
deleter tensor of variant values

tf.Any (::mlir::TF::AnyOp)

Computes the "logical or" of elements across dimensions of a tensor.

Reduces input along the dimensions given in axis. Unless keep_dims is true, the rank of the tensor is reduced by 1 for each entry in axis. If keep_dims is true, the reduced dimensions are retained with length 1.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
keep_dims ::mlir::BoolAttr bool attribute
Tidx ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of bool values
reduction_indices tensor of 32/64-bit signed integer values

Results:

Result Description
output tensor of bool values

tf.ApproximateEqual (::mlir::TF::ApproximateEqualOp)

Returns the truth value of abs(x-y) < tolerance element-wise.

Traits: Commutative

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
tolerance ::mlir::FloatAttr 32-bit float attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values
y tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

Results:

Result Description
z tensor of bool values

tf.ArgMax (::mlir::TF::ArgMaxOp)

Returns the index with the largest value across dimensions of a tensor.

Note that in case of ties the identity of the return value is not guaranteed.

Usage:

  import tensorflow as tf
  a = [1, 10, 26.9, 2.8, 166.32, 62.3]
  b = tf.math.argmax(input = a)
  c = tf.keras.backend.eval(b)
  # c = 4
  # here a[4] = 166.32 which is the largest element of a across axis 0

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute
Tidx ::mlir::Attribute derived attribute
output_type ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of bfloat16 or bool or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values
dimension tensor of 32/64-bit signed integer values

Results:

Result Description
output tensor of 32/64-bit signed integer values

tf.ArgMin (::mlir::TF::ArgMinOp)

Returns the index with the smallest value across dimensions of a tensor.

Note that in case of ties the identity of the return value is not guaranteed.

Usage:

  import tensorflow as tf
  a = [1, 10, 26.9, 2.8, 166.32, 62.3]
  b = tf.math.argmin(input = a)
  c = tf.keras.backend.eval(b)
  # c = 0
  # here a[0] = 1 which is the smallest element of a across axis 0

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute
Tidx ::mlir::Attribute derived attribute
output_type ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of bfloat16 or bool or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values
dimension tensor of 32/64-bit signed integer values

Results:

Result Description
output tensor of 32/64-bit signed integer values

tf.AsString (::mlir::TF::AsStringOp)

Converts each entry in the given tensor to strings.

Supports many numeric types and boolean.

For Unicode, see the https://www.tensorflow.org/tutorials/representation/unicode tutorial.

Examples:

tf.strings.as_string([3, 2]) tf.strings.as_string([3.1415926, 2.71828], precision=2).numpy() array([b'3.14', b'2.72'], dtype=object)

Traits: SameOperandsAndResultShape

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
precision ::mlir::IntegerAttr 64-bit signless integer attribute
scientific ::mlir::BoolAttr bool attribute
shortest ::mlir::BoolAttr bool attribute
width ::mlir::IntegerAttr 64-bit signless integer attribute
fill ::mlir::StringAttr string attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of bfloat16 or bool or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer or variant values

Results:

Result Description
output tensor of string values

tf.Asin (::mlir::TF::AsinOp)

Computes the trignometric inverse sine of x element-wise.

The tf.math.asin operation returns the inverse of tf.math.sin, such that if y = tf.math.sin(x) then, x = tf.math.asin(y).

For example:

# Note: [1.047, 0.785] ~= [(pi/3), (pi/4)]
x = tf.constant([1.047, 0.785])
y = tf.math.sin(x) # [0.8659266, 0.7068252]

tf.math.asin(y) # [1.047, 0.785] = x

Traits: TF_SameOperandsAndResultTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer values

Results:

Result Description
y tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer values

tf.Asinh (::mlir::TF::AsinhOp)

Computes inverse hyperbolic sine of x element-wise.

Given an input tensor, this function computes inverse hyperbolic sine for every element in the tensor. Both input and output has a range of [-inf, inf].

  x = tf.constant([-float("inf"), -2, -0.5, 1, 1.2, 200, 10000, float("inf")])
  tf.math.asinh(x) ==> [-inf -1.4436355 -0.4812118 0.8813736 1.0159732 5.991471 9.903487 inf]

Traits: TF_SameOperandsAndResultTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of floating-point or complex values

Results:

Result Description
y tensor of floating-point or complex values

tf.Assert (::mlir::TF::AssertOp)

Asserts that the given condition is true.

If condition evaluates to false, print the list of tensors in data. summarize determines how many entries of the tensors to print.

Attributes:

Attribute MLIR Type Description
summarize ::mlir::IntegerAttr 64-bit signless integer attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
condition tensor of bool values
data tensor of tf.dtype values

tf.AssignAddVariableOp (::mlir::TF::AssignAddVariableOp)

Adds a value to the current value of a variable.

Any ReadVariableOp with a control dependency on this op is guaranteed to see the incremented value or a subsequent newer one.

Attributes:

Attribute MLIR Type Description
dtype ::mlir::Attribute derived attribute

Operands:

Operand Description
resource tensor of resource values
value tensor of tf.dtype values

tf.Assign (::mlir::TF::AssignOp)

Update 'ref' by assigning 'value' to it.

This operation outputs "ref" after the assignment is done. This makes it easier to chain operations that need to use the reset value.

Attributes:

Attribute MLIR Type Description
validate_shape ::mlir::BoolAttr bool attribute
use_locking ::mlir::BoolAttr bool attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
ref tensor of tf.dtype values
value tensor of tf.dtype values

Results:

Result Description
output_ref tensor of tf.dtype values

tf.AssignSubVariableOp (::mlir::TF::AssignSubVariableOp)

Subtracts a value from the current value of a variable.

Any ReadVariableOp with a control dependency on this op is guaranteed to see the decremented value or a subsequent newer one.

Attributes:

Attribute MLIR Type Description
dtype ::mlir::Attribute derived attribute

Operands:

Operand Description
resource tensor of resource values
value tensor of tf.dtype values

tf.AssignVariableOp (::mlir::TF::AssignVariableOp)

Assigns a new value to a variable.

Any ReadVariableOp with a control dependency on this op is guaranteed to return this value or a subsequent newer value of the variable.

Attributes:

Attribute MLIR Type Description
validate_shape ::mlir::BoolAttr bool attribute
dtype ::mlir::Attribute derived attribute

Operands:

Operand Description
resource tensor of resource values
value tensor of tf.dtype values

tf.Atan2 (::mlir::TF::Atan2Op)

Computes arctangent of y/x element-wise, respecting signs of the arguments.

This is the angle \( \theta \in [-\pi, \pi] \) such that \[ x = r \cos(\theta) \] and \[ y = r \sin(\theta) \] where \(r = \sqrt{x^2 + y^2} \).

For example:

x = [1., 1.] y = [1., -1.] print((tf.math.atan2(y,x) * (180 / np.pi)).numpy()) [ 45. -45.]

Traits: ResultsBroadcastableShape, TF_SameOperandsAndResultElementTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
y tensor of floating-point values
x tensor of floating-point values

Results:

Result Description
z tensor of floating-point values

tf.Atan (::mlir::TF::AtanOp)

Computes the trignometric inverse tangent of x element-wise.

The tf.math.atan operation returns the inverse of tf.math.tan, such that if y = tf.math.tan(x) then, x = tf.math.atan(y).

For example:

# Note: [1.047, 0.785] ~= [(pi/3), (pi/4)]
x = tf.constant([1.047, 0.785])
y = tf.math.tan(x) # [1.731261, 0.99920404]

tf.math.atan(y) # [1.047, 0.785] = x

Traits: SameOperandsAndResultType

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer values

Results:

Result Description
y tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer values

tf.Atanh (::mlir::TF::AtanhOp)

Computes inverse hyperbolic tangent of x element-wise.

Given an input tensor, this function computes inverse hyperbolic tangent for every element in the tensor. Input range is [-1,1] and output range is [-inf, inf]. If input is -1, output will be -inf and if the input is 1, output will be inf. Values outside the range will have nan as output.

  x = tf.constant([-float("inf"), -1, -0.5, 1, 0, 0.5, 10, float("inf")])
  tf.math.atanh(x) ==> [nan -inf -0.54930615 inf  0. 0.54930615 nan nan]

Traits: TF_SameOperandsAndResultTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of floating-point or complex values

Results:

Result Description
y tensor of floating-point or complex values

tf.AvgPool3DGrad (::mlir::TF::AvgPool3DGradOp)

Computes gradients of average pooling function.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
ksize ::mlir::ArrayAttr 64-bit integer array attribute with at least 5 elements
strides ::mlir::ArrayAttr 64-bit integer array attribute with at least 5 elements
padding ::mlir::StringAttr string attribute whose value is SAME, or VALID
data_format ::mlir::StringAttr string attribute whose value is NDHWC, or NCDHW
T ::mlir::Attribute derived attribute

Operands:

Operand Description
orig_input_shape tensor of 32-bit integer values
grad tensor of floating-point values

Results:

Result Description
output tensor of floating-point values

tf.AvgPool3D (::mlir::TF::AvgPool3DOp)

Performs 3D average pooling on the input.

Each entry in output is the mean of the corresponding size ksize window in value.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
ksize ::mlir::ArrayAttr 64-bit integer array attribute with at least 5 elements
strides ::mlir::ArrayAttr 64-bit integer array attribute with at least 5 elements
padding ::mlir::StringAttr string attribute whose value is SAME, or VALID
data_format ::mlir::StringAttr string attribute whose value is NDHWC, or NCDHW
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of floating-point values

Results:

Result Description
output tensor of floating-point values

tf.AvgPoolGrad (::mlir::TF::AvgPoolGradOp)

Computes gradients of the average pooling function.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
ksize ::mlir::ArrayAttr 64-bit integer array attribute with at least 4 elements
strides ::mlir::ArrayAttr 64-bit integer array attribute with at least 4 elements
padding ::mlir::StringAttr string attribute whose value is SAME, or VALID
data_format ::mlir::StringAttr 'NHWC' or 'NCHW' convnet data format
T ::mlir::Attribute derived attribute

Operands:

Operand Description
orig_input_shape tensor of 32-bit integer values
grad tensor of floating-point values

Results:

Result Description
output tensor of floating-point values

tf.AvgPool (::mlir::TF::AvgPoolOp)

Performs average pooling on the input.

Each entry in output is the mean of the corresponding size ksize window in value.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
ksize ::mlir::ArrayAttr 64-bit integer array attribute with at least 4 elements
strides ::mlir::ArrayAttr 64-bit integer array attribute with at least 4 elements
padding ::mlir::StringAttr string attribute whose value is SAME, or VALID
data_format ::mlir::StringAttr 'NHWC' or 'NCHW' convnet data format
T ::mlir::Attribute derived attribute

Operands:

Operand Description
value tensor of floating-point values

Results:

Result Description
output tensor of floating-point values

tf.BatchDatasetV2 (::mlir::TF::BatchDatasetV2Op)

Creates a dataset that batches batch_size elements from input_dataset.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
parallel_copy ::mlir::BoolAttr bool attribute
output_types ::mlir::ArrayAttr type array attribute with at least 1 elements
output_shapes ::mlir::ArrayAttr tensorflow shape attribute array with at least 1 elements
metadata ::mlir::StringAttr string attribute

Operands:

Operand Description
input_dataset tensor of variant values
batch_size tensor of 64-bit integer values
drop_remainder tensor of bool values

Results:

Result Description
handle tensor of variant values

tf.BatchFunction (::mlir::TF::BatchFunctionOp)

Batches all the inputs tensors to the computation done by the function.

So, for example, in the following code


  # This input will be captured.
  y = tf.placeholder_with_default(1.0, shape=[])

  @tf.Defun(tf.float32)
  def computation(a):
    return tf.matmul(a, a) + y

  b = gen_batch_ops.batch_function(
          f=computation
          in_tensors=[a],
          captured_tensors=computation.captured_inputs,
          Tout=[o.type for o in computation.definition.signature.output_arg],
          num_batch_threads=1,
          max_batch_size=10,
          batch_timeout_micros=100000,  # 100ms
          allowed_batch_sizes=[3, 10],
          batching_queue="")

If more than one session.run call is simultaneously trying to compute b the values of a will be gathered, non-deterministically concatenated along the first axis, and only one thread will run the computation.

Assumes that all arguments of the function are Tensors which will be batched along their first dimension.

Arguments that are captured, are not batched. The session.run call which does the concatenation, will use the values of the captured tensors available to it. Therefore, typical uses of captured tensors should involve values which remain unchanged across session.run calls. Inference is a good example of this.

SparseTensor is not supported. The return value of the decorated function must be a Tensor or a list/tuple of Tensors.

Traits: AttrSizedOperandSegments

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
f ::mlir::SymbolRefAttr symbol reference attribute
num_batch_threads ::mlir::IntegerAttr 64-bit signless integer attribute
max_batch_size ::mlir::IntegerAttr 64-bit signless integer attribute
batch_timeout_micros ::mlir::IntegerAttr 64-bit signless integer attribute
max_enqueued_batches ::mlir::IntegerAttr 64-bit signless integer attribute
allowed_batch_sizes ::mlir::ArrayAttr 64-bit integer array attribute
container ::mlir::StringAttr string attribute
shared_name ::mlir::StringAttr string attribute
batching_queue ::mlir::StringAttr string attribute
enable_large_batch_splitting ::mlir::BoolAttr bool attribute
Tcaptured ::mlir::Attribute derived attribute
Tin ::mlir::Attribute derived attribute
Tout ::mlir::Attribute derived attribute

Operands:

Operand Description
in_tensors tensor of tf.dtype values
captured_tensors tensor of tf.dtype values

Results:

Result Description
out_tensors tensor of tf.dtype values

tf.BatchMatMul (::mlir::TF::BatchMatMulOp)

Multiplies slices of two tensors in batches.

Multiplies all slices of Tensor x and y (each slice can be viewed as an element of a batch), and arranges the individual results in a single output tensor of the same batch size. Each of the individual slices can optionally be adjointed (to adjoint a matrix means to transpose and conjugate it) before multiplication by setting the adj_x or adj_y flag to True, which are by default False.

The input tensors x and y are 2-D or higher with shape [..., r_x, c_x] and [..., r_y, c_y].

The output tensor is 2-D or higher with shape [..., r_o, c_o], where:

r_o = c_x if adj_x else r_x
c_o = r_y if adj_y else c_y

It is computed as:

output[..., :, :] = matrix(x[..., :, :]) * matrix(y[..., :, :])

Traits: TF_SameOperandsAndResultElementTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
adj_x ::mlir::BoolAttr bool attribute
adj_y ::mlir::BoolAttr bool attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 32-bit integer or 64-bit integer values
y tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 32-bit integer or 64-bit integer values

Results:

Result Description
output tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 32-bit integer or 64-bit integer values

tf.BatchMatMulV2 (::mlir::TF::BatchMatMulV2Op)

Multiplies slices of two tensors in batches.

Multiplies all slices of Tensor x and y (each slice can be viewed as an element of a batch), and arranges the individual results in a single output tensor of the same batch size. Each of the individual slices can optionally be adjointed (to adjoint a matrix means to transpose and conjugate it) before multiplication by setting the adj_x or adj_y flag to True, which are by default False.

The input tensors x and y are 2-D or higher with shape [..., r_x, c_x] and [..., r_y, c_y].

The output tensor is 2-D or higher with shape [..., r_o, c_o], where:

r_o = c_x if adj_x else r_x
c_o = r_y if adj_y else c_y

It is computed as:

output[..., :, :] = matrix(x[..., :, :]) * matrix(y[..., :, :])

Traits: TF_SameOperandsAndResultElementTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
adj_x ::mlir::BoolAttr bool attribute
adj_y ::mlir::BoolAttr bool attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer values
y tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer values

Results:

Result Description
output tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer values

tf.BatchMatMulV3 (::mlir::TF::BatchMatMulV3Op)

Multiplies slices of two tensors in batches.

Multiplies all slices of Tensor x and y (each slice can be viewed as an element of a batch), and arranges the individual results in a single output tensor of the same batch size. Each of the individual slices can optionally be adjointed (to adjoint a matrix means to transpose and conjugate it) before multiplication by setting the adj_x or adj_y flag to True, which are by default False.

The input tensors x and y are 2-D or higher with shape [..., r_x, c_x] and [..., r_y, c_y].

The output tensor is 2-D or higher with shape [..., r_o, c_o], where:

r_o = c_x if adj_x else r_x
c_o = r_y if adj_y else c_y

It is computed as:

output[..., :, :] = matrix(x[..., :, :]) * matrix(y[..., :, :])

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
adj_x ::mlir::BoolAttr bool attribute
adj_y ::mlir::BoolAttr bool attribute
Ta ::mlir::Attribute derived attribute
Tb ::mlir::Attribute derived attribute
Tout ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 8-bit unsigned integer values
y tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 8-bit unsigned integer values

Results:

Result Description
output tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer values

tf.BatchNormWithGlobalNormalization (::mlir::TF::BatchNormWithGlobalNormalizationOp)

Batch normalization.

This op is deprecated. Prefer tf.nn.batch_normalization.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
variance_epsilon ::mlir::FloatAttr 32-bit float attribute
scale_after_normalization ::mlir::BoolAttr bool attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
t tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values
m tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values
v tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values
beta tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values
gamma tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

Results:

Result Description
result tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

tf.BatchToSpaceND (::mlir::TF::BatchToSpaceNDOp)

BatchToSpace for N-D tensors of type T.

This operation reshapes the "batch" dimension 0 into M + 1 dimensions of shape block_shape + [batch], interleaves these blocks back into the grid defined by the spatial dimensions [1, ..., M], to obtain a result with the same rank as the input. The spatial dimensions of this intermediate result are then optionally cropped according to crops to produce the output. This is the reverse of SpaceToBatch. See below for a precise description.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute
Tblock_shape ::mlir::Attribute derived attribute
Tcrops ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of tf.dtype values
block_shape tensor of 32/64-bit signed integer values
crops tensor of 32/64-bit signed integer values

Results:

Result Description
output tensor of tf.dtype values

tf.BatchToSpace (::mlir::TF::BatchToSpaceOp)

BatchToSpace for 4-D tensors of type T.

This is a legacy version of the more general BatchToSpaceND.

Rearranges (permutes) data from batch into blocks of spatial data, followed by cropping. This is the reverse transformation of SpaceToBatch. More specifically, this op outputs a copy of the input tensor where values from the batch dimension are moved in spatial blocks to the height and width dimensions, followed by cropping along the height and width dimensions.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
block_size ::mlir::IntegerAttr 64-bit signless integer attribute whose minimum value is 2
T ::mlir::Attribute derived attribute
Tidx ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of tf.dtype values
crops tensor of 32/64-bit signed integer values

Results:

Result Description
output tensor of tf.dtype values

tf.BesselI0e (::mlir::TF::BesselI0eOp)

Computes the Bessel i0e function of x element-wise.

Exponentially scaled modified Bessel function of order 0 defined as bessel_i0e(x) = exp(-abs(x)) bessel_i0(x).

This function is faster and numerically stabler than bessel_i0(x).

Traits: SameOperandsAndResultType

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of floating-point values

Results:

Result Description
y tensor of floating-point values

tf.BesselI1e (::mlir::TF::BesselI1eOp)

Computes the Bessel i1e function of x element-wise.

Exponentially scaled modified Bessel function of order 0 defined as bessel_i1e(x) = exp(-abs(x)) bessel_i1(x).

This function is faster and numerically stabler than bessel_i1(x).

Traits: SameOperandsAndResultType

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of floating-point values

Results:

Result Description
y tensor of floating-point values

tf.Betainc (::mlir::TF::BetaincOp)

Compute the regularized incomplete beta integral \(I_x(a, b)\).

The regularized incomplete beta integral is defined as:

\(I_x(a, b) = \frac{B(x; a, b)}{B(a, b)}\)

where

\(B(x; a, b) = \int_0^x t^{a-1} (1 - t)^{b-1} dt\)

is the incomplete beta function and \(B(a, b)\) is the complete beta function.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
a tensor of 32/64-bit float values
b tensor of 32/64-bit float values
x tensor of 32/64-bit float values

Results:

Result Description
z tensor of 32/64-bit float values

tf.BiasAddGrad (::mlir::TF::BiasAddGradOp)

The backward operation for "BiasAdd" on the "bias" tensor.

It accumulates all the values from out_backprop into the feature dimension. For NHWC data format, the feature dimension is the last. For NCHW data format, the feature dimension is the third-to-last.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
data_format ::mlir::StringAttr 'NHWC' or 'NCHW' convnet data format
T ::mlir::Attribute derived attribute

Operands:

Operand Description
out_backprop tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

Results:

Result Description
output tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

tf.BiasAdd (::mlir::TF::BiasAddOp)

Adds bias to value.

This is a special case of tf.add where bias is restricted to be 1-D. Broadcasting is supported, so value may have any number of dimensions.

Interfaces: NoSideEffect (MemoryEffectOpInterface), TF_LayoutSensitiveInterface

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
data_format ::mlir::StringAttr 'NHWC' or 'NCHW' convnet data format
T ::mlir::Attribute derived attribute

Operands:

Operand Description
value tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values
bias tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

Results:

Result Description
output tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

tf.BiasAddV1 (::mlir::TF::BiasAddV1Op)

Adds bias to value.

This is a deprecated version of BiasAdd and will be soon removed.

This is a special case of tf.add where bias is restricted to be 1-D. Broadcasting is supported, so value may have any number of dimensions.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
value tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values
bias tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

Results:

Result Description
output tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

tf.Bincount (::mlir::TF::BincountOp)

Counts the number of occurrences of each value in an integer array.

Outputs a vector with length size and the same dtype as weights. If weights are empty, then index i stores the number of times the value i is counted in arr. If weights are non-empty, then index i stores the sum of the value in weights at each index where the corresponding value in arr is i.

Values in arr outside of the range [0, size) are ignored.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
arr tensor of 32-bit integer values
size tensor of 32-bit integer values
weights tensor of 32-bit float or 64-bit float or 32-bit integer or 64-bit integer values

Results:

Result Description
bins tensor of 32-bit float or 64-bit float or 32-bit integer or 64-bit integer values

tf.Bitcast (::mlir::TF::BitcastOp)

Bitcasts a tensor from one type to another without copying data.

Given a tensor input, this operation returns a tensor that has the same buffer data as input with datatype type.

If the input datatype T is larger than the output datatype type then the shape changes from [...] to [..., sizeof(T)/sizeof(type)].

If T is smaller than type, the operator requires that the rightmost dimension be equal to sizeof(type)/sizeof(T). The shape then goes from [..., sizeof(type)/sizeof(T)] to [...].

tf.bitcast() and tf.cast() work differently when real dtype is casted as a complex dtype (e.g. tf.complex64 or tf.complex128) as tf.cast() make imaginary part 0 while tf.bitcast() gives module error. For example,

Example 1:

a = [1., 2., 3.] equality_bitcast = tf.bitcast(a, tf.complex128) Traceback (most recent call last): ... InvalidArgumentError: Cannot bitcast from 1 to 18 [Op:Bitcast] equality_cast = tf.cast(a, tf.complex128) print(equality_cast) tf.Tensor([1.+0.j 2.+0.j 3.+0.j], shape=(3,), dtype=complex128)

Example 2:

tf.bitcast(tf.constant(0xffffffff, dtype=tf.uint32), tf.uint8)

Example 3:

x = [1., 2., 3.] y = [0., 2., 3.] equality= tf.equal(x,y) equality_cast = tf.cast(equality,tf.float32) equality_bitcast = tf.bitcast(equality_cast,tf.uint8) print(equality) tf.Tensor([False True True], shape=(3,), dtype=bool) print(equality_cast) tf.Tensor([0. 1. 1.], shape=(3,), dtype=float32) print(equality_bitcast) tf.Tensor( [[ 0 0 0 0] [ 0 0 128 63] [ 0 0 128 63]], shape=(3, 4), dtype=uint8)

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute
type ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of number values

Results:

Result Description
output tensor of number values

tf.BitwiseAnd (::mlir::TF::BitwiseAndOp)

Elementwise computes the bitwise AND of x and y.

The result will have those bits set, that are set in both x and y. The computation is performed on the underlying representations of x and y.

For example:

import tensorflow as tf
from tensorflow.python.ops import bitwise_ops
dtype_list = [tf.int8, tf.int16, tf.int32, tf.int64,
              tf.uint8, tf.uint16, tf.uint32, tf.uint64]

for dtype in dtype_list:
  lhs = tf.constant([0, 5, 3, 14], dtype=dtype)
  rhs = tf.constant([5, 0, 7, 11], dtype=dtype)
  exp = tf.constant([0, 0, 3, 10], dtype=tf.float32)

  res = bitwise_ops.bitwise_and(lhs, rhs)
  tf.assert_equal(tf.cast(res, tf.float32), exp) # TRUE

Traits: Commutative, ResultsBroadcastableShape

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of integer values
y tensor of integer values

Results:

Result Description
z tensor of integer values

tf.BitwiseOr (::mlir::TF::BitwiseOrOp)

Elementwise computes the bitwise OR of x and y.

The result will have those bits set, that are set in x, y or both. The computation is performed on the underlying representations of x and y.

For example:

import tensorflow as tf
from tensorflow.python.ops import bitwise_ops
dtype_list = [tf.int8, tf.int16, tf.int32, tf.int64,
              tf.uint8, tf.uint16, tf.uint32, tf.uint64]

for dtype in dtype_list:
  lhs = tf.constant([0, 5, 3, 14], dtype=dtype)
  rhs = tf.constant([5, 0, 7, 11], dtype=dtype)
  exp = tf.constant([5, 5, 7, 15], dtype=tf.float32)

  res = bitwise_ops.bitwise_or(lhs, rhs)
  tf.assert_equal(tf.cast(res,  tf.float32), exp)  # TRUE

Traits: Commutative, ResultsBroadcastableShape

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of integer values
y tensor of integer values

Results:

Result Description
z tensor of integer values

tf.BitwiseXor (::mlir::TF::BitwiseXorOp)

Elementwise computes the bitwise XOR of x and y.

The result will have those bits set, that are different in x and y. The computation is performed on the underlying representations of x and y.

For example:

import tensorflow as tf
from tensorflow.python.ops import bitwise_ops
dtype_list = [tf.int8, tf.int16, tf.int32, tf.int64,
              tf.uint8, tf.uint16, tf.uint32, tf.uint64]

for dtype in dtype_list:
  lhs = tf.constant([0, 5, 3, 14], dtype=dtype)
  rhs = tf.constant([5, 0, 7, 11], dtype=dtype)
  exp = tf.constant([5, 5, 4, 5],  dtype=tf.float32)

  res = bitwise_ops.bitwise_xor(lhs, rhs)
  tf.assert_equal(tf.cast(res, tf.float32), exp) # TRUE

Traits: Commutative, ResultsBroadcastableShape

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of integer values
y tensor of integer values

Results:

Result Description
z tensor of integer values

tf.BoostedTreesBucketize (::mlir::TF::BoostedTreesBucketizeOp)

Bucketize each feature based on bucket boundaries.

An op that returns a list of float tensors, where each tensor represents the bucketized values for a single feature.

Traits: SameVariadicOperandSize

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
num_features ::mlir::Attribute derived attribute

Operands:

Operand Description
float_values tensor of 32-bit float values
bucket_boundaries tensor of 32-bit float values

Results:

Result Description
buckets tensor of 32-bit integer values

tf.BroadcastArgs (::mlir::TF::BroadcastArgsOp)

Return the shape of s0 op s1 with broadcast.

Given s0 and s1, tensors that represent shapes, compute r0, the broadcasted shape. s0, s1 and r0 are all integer vectors.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
s0 tensor of 32/64-bit signed integer values
s1 tensor of 32/64-bit signed integer values

Results:

Result Description
r0 tensor of 32/64-bit signed integer values

tf.BroadcastGradientArgs (::mlir::TF::BroadcastGradientArgsOp)

Return the reduction indices for computing gradients of s0 op s1 with broadcast.

This is typically used by gradient computations for a broadcasting operation.

Traits: SameOperandsAndResultElementType

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
s0 tensor of 32/64-bit signed integer values
s1 tensor of 32/64-bit signed integer values

Results:

Result Description
r0 tensor of 32/64-bit signed integer values
r1 tensor of 32/64-bit signed integer values

tf.BroadcastTo (::mlir::TF::BroadcastToOp)

Broadcast an array for a compatible shape.

Broadcasting is the process of making arrays to have compatible shapes for arithmetic operations. Two shapes are compatible if for each dimension pair they are either equal or one of them is one. When trying to broadcast a Tensor to a shape, it starts with the trailing dimensions, and works its way forward.

For example,

x = tf.constant([1, 2, 3]) y = tf.broadcast_to(x, [3, 3]) print(y) tf.Tensor( [[1 2 3] [1 2 3] [1 2 3]], shape=(3, 3), dtype=int32)

In the above example, the input Tensor with the shape of [1, 3] is broadcasted to output Tensor with shape of [3, 3].

When doing broadcasted operations such as multiplying a tensor by a scalar, broadcasting (usually) confers some time or space benefit, as the broadcasted tensor is never materialized.

However, broadcast_to does not carry with it any such benefits. The newly-created tensor takes the full memory of the broadcasted shape. (In a graph context, broadcast_to might be fused to subsequent operation and then be optimized away, however.)

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute
Tidx ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of tf.dtype values
shape tensor of 32/64-bit signed integer values

Results:

Result Description
output tensor of tf.dtype values

tf.Bucketize (::mlir::TF::BucketizeOp)

Bucketizes 'input' based on 'boundaries'.

For example, if the inputs are boundaries = [0, 10, 100] input = [[-5, 10000] [150, 10] [5, 100]]

then the output will be output = [[0, 3] [3, 2] [1, 3]]

Traits: SameOperandsAndResultShape

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
boundaries ::mlir::ArrayAttr 32-bit float array attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of 32-bit float or 64-bit float or 32-bit integer or 64-bit integer values

Results:

Result Description
output tensor of 32-bit integer values

tf.CacheDatasetV2 (::mlir::TF::CacheDatasetV2Op)

Attributes:

Attribute MLIR Type Description
output_types ::mlir::ArrayAttr type array attribute with at least 1 elements
output_shapes ::mlir::ArrayAttr tensorflow shape attribute array with at least 1 elements
metadata ::mlir::StringAttr string attribute

Operands:

Operand Description
input_dataset tensor of variant values
filename tensor of string values
cache tensor of resource values

Results:

Result Description
handle tensor of variant values

tf.Case (::mlir::TF::CaseOp)

An n-way switch statement which calls a single branch function.

An n-way switch statement, implementing the following:

```
switch (branch_index) {
  case 0:
    output = branches[0](input);
    break;
  case 1:
    output = branches[1](input);
    break;
  ...
  case [[nbranches-1]]:
  default:
    output = branches[nbranches-1](input);
    break;
}
```

Interfaces: SymbolUserOpInterface

Attributes:

Attribute MLIR Type Description
branches ::mlir::ArrayAttr symbol ref array attribute with at least 1 elements
is_stateless ::mlir::BoolAttr bool attribute
Tin ::mlir::Attribute derived attribute
Tout ::mlir::Attribute derived attribute
output_shapes ::mlir::Attribute derived attribute

Operands:

Operand Description
branch_index tensor of 32-bit signless integer values
input tensor of tf.dtype values

Results:

Result Description
output tensor of tf.dtype values

tf.CaseRegion (::mlir::TF::CaseRegionOp)

An n-way switch statement which calls a single branch function.

An n-way switch statement, implementing the following:

```
switch (branch_index) {
  case 0:
    output = branches[0](input);
    break;
  case 1:
    output = branches[1](input);
    break;
  ...
  case [[nbranches-1]]:
  default:
    output = branches[nbranches-1](input);
    break;
}
```

Traits: NoRegionArguments, SingleBlockImplicitTerminator

Attributes:

Attribute MLIR Type Description
is_stateless ::mlir::BoolAttr bool attribute

Operands:

Operand Description
branch_index tensor of 32-bit signless integer values

Results:

Result Description
output tensor of tf.dtype values

tf.Cast (::mlir::TF::CastOp)

Cast x of type SrcT to y of DstT.

Traits: SameOperandsAndResultShape

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
Truncate ::mlir::BoolAttr bool attribute
SrcT ::mlir::Attribute derived attribute
DstT ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of tf.dtype values

Results:

Result Description
y tensor of tf.dtype values

tf.Ceil (::mlir::TF::CeilOp)

Returns element-wise smallest integer not less than x.

Traits: Idempotent, SameOperandsAndResultType

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of floating-point values

Results:

Result Description
y tensor of floating-point values

tf.CheckNumerics (::mlir::TF::CheckNumericsOp)

Checks a tensor for NaN and Inf values.

When run, reports an InvalidArgument error if tensor has any values that are not a number (NaN) or infinity (Inf). Otherwise, returns the input tensor.

Example usage:

a = tf.Variable(1.0)
tf.debugging.check_numerics(a, message='')

b = tf.Variable(np.nan)
try:
  tf.debugging.check_numerics(b, message='Checking b')
except Exception as e:
  assert "Checking b : Tensor had NaN values" in e.message

c = tf.Variable(np.inf)
try:
  tf.debugging.check_numerics(c, message='Checking c')
except Exception as e:
  assert "Checking c : Tensor had Inf values" in e.message

Traits: TF_SameOperandsAndResultTypeResolveRef

Attributes:

Attribute MLIR Type Description
message ::mlir::StringAttr string attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
tensor tensor of floating-point values

Results:

Result Description
output tensor of floating-point values

tf.Cholesky (::mlir::TF::CholeskyOp)

Computes the Cholesky decomposition of one or more square matrices.

The input is a tensor of shape [..., M, M] whose inner-most 2 dimensions form square matrices.

The input has to be symmetric and positive definite. Only the lower-triangular part of the input will be used for this operation. The upper-triangular part will not be read.

The output is a tensor of the same shape as the input containing the Cholesky decompositions for all input submatrices [..., :, :].

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float values

Results:

Result Description
output tensor of 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float values

tf.ClipByValue (::mlir::TF::ClipByValueOp)

Clips tensor values to a specified min and max.

Given a tensor t, this operation returns a tensor of the same type and shape as t with its values clipped to clip_value_min and clip_value_max. Any values less than clip_value_min are set to clip_value_min. Any values greater than clip_value_max are set to clip_value_max.

Traits: TF_SameOperandsAndResultElementTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
t tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values
clip_value_min tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values
clip_value_max tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

Results:

Result Description
output tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

tf.CloseSummaryWriter (::mlir::TF::CloseSummaryWriterOp)

Flushes and closes the summary writer.

Also removes it from the resource manager. To reopen, use another CreateSummaryFileWriter op.

writer: A handle to the summary writer resource.

Operands:

Operand Description
writer tensor of resource values

tf.CollectiveBcastRecv (::mlir::TF::CollectiveBcastRecvOp)

Receives a tensor value broadcast from another device.

Attributes:

Attribute MLIR Type Description
group_size ::mlir::IntegerAttr 64-bit signless integer attribute
group_key ::mlir::IntegerAttr 64-bit signless integer attribute
instance_key ::mlir::IntegerAttr 64-bit signless integer attribute
shape ::mlir::Attribute TensorFlow shape attribute
communication_hint ::mlir::StringAttr string attribute
timeout_seconds ::mlir::FloatAttr 32-bit float attribute
T ::mlir::Attribute derived attribute

Results:

Result Description
data tensor of bool or 16-bit float or 32-bit float or 64-bit float or 32-bit integer or 64-bit integer values

tf.CollectiveBcastSend (::mlir::TF::CollectiveBcastSendOp)

Broadcasts a tensor value to one or more other devices.

Attributes:

Attribute MLIR Type Description
group_size ::mlir::IntegerAttr 64-bit signless integer attribute
group_key ::mlir::IntegerAttr 64-bit signless integer attribute
instance_key ::mlir::IntegerAttr 64-bit signless integer attribute
shape ::mlir::Attribute TensorFlow shape attribute
communication_hint ::mlir::StringAttr string attribute
timeout_seconds ::mlir::FloatAttr 32-bit float attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of bool or 16-bit float or 32-bit float or 64-bit float or 32-bit integer or 64-bit integer values

Results:

Result Description
data tensor of bool or 16-bit float or 32-bit float or 64-bit float or 32-bit integer or 64-bit integer values

tf.CollectiveGather (::mlir::TF::CollectiveGatherOp)

Mutually accumulates multiple tensors of identical type and shape.

Attributes:

Attribute MLIR Type Description
group_size ::mlir::IntegerAttr 64-bit signless integer attribute
group_key ::mlir::IntegerAttr 64-bit signless integer attribute
instance_key ::mlir::IntegerAttr 64-bit signless integer attribute
shape ::mlir::Attribute TensorFlow shape attribute
communication_hint ::mlir::StringAttr string attribute
timeout_seconds ::mlir::FloatAttr 32-bit float attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of 16-bit float or 32-bit float or 64-bit float or 32-bit integer or 64-bit integer values

Results:

Result Description
data tensor of 16-bit float or 32-bit float or 64-bit float or 32-bit integer or 64-bit integer values

tf.CollectivePermute (::mlir::TF::CollectivePermuteOp)

An Op to permute tensors across replicated TPU instances.

Each instance supplies its own input.

For example, suppose there are 4 TPU instances: [A, B, C, D]. Passing source_target_pairs=[[0,1],[1,2],[2,3],[3,0]] gets the outputs: [D, A, B, C].

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values
source_target_pairs tensor of 32-bit integer values

Results:

Result Description
output tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

tf.CollectiveReduce (::mlir::TF::CollectiveReduceOp)

Mutually reduces multiple tensors of identical type and shape.

Traits: TF_SameOperandsAndResultTypeResolveRef

Attributes:

Attribute MLIR Type Description
group_size ::mlir::IntegerAttr 64-bit signless integer attribute
group_key ::mlir::IntegerAttr 64-bit signless integer attribute
instance_key ::mlir::IntegerAttr 64-bit signless integer attribute
merge_op ::mlir::StringAttr string attribute whose value is Min, or Max, or Mul, or Add
final_op ::mlir::StringAttr string attribute whose value is Id, or Div
subdiv_offsets ::mlir::ArrayAttr 64-bit integer array attribute
wait_for ::mlir::ArrayAttr 64-bit integer array attribute
communication_hint ::mlir::StringAttr string attribute
timeout_seconds ::mlir::FloatAttr 32-bit float attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of floating-point or 32/64-bit signed integer values

Results:

Result Description
data tensor of floating-point or 32/64-bit signed integer values

tf.CollectiveReduceV2 (::mlir::TF::CollectiveReduceV2Op)

Mutually reduces multiple tensors of identical type and shape.

Attributes:

Attribute MLIR Type Description
merge_op ::mlir::StringAttr string attribute whose value is Min, or Max, or Mul, or Add
final_op ::mlir::StringAttr string attribute whose value is Id, or Div
communication_hint ::mlir::StringAttr string attribute
timeout_seconds ::mlir::FloatAttr 32-bit float attribute
max_subdivs_per_device ::mlir::IntegerAttr 64-bit signless integer attribute
Nordering_token ::mlir::Attribute derived attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of floating-point or 32/64-bit signed integer values
group_size tensor of 32-bit integer values
group_key tensor of 32-bit integer values
instance_key tensor of 32-bit integer values
ordering_token tensor of resource values

Results:

Result Description
data tensor of floating-point or 32/64-bit signed integer values

tf.ComplexAbs (::mlir::TF::ComplexAbsOp)

Computes the complex absolute value of a tensor.

Given a tensor x of complex numbers, this operation returns a tensor of type float or double that is the absolute value of each element in x. All elements in x must be complex numbers of the form \(a + bj\). The absolute value is computed as \( \sqrt{a^2 + b^2}\).

For example:

x = tf.complex(3.0, 4.0) print((tf.raw_ops.ComplexAbs(x=x, Tout=tf.dtypes.float32, name=None)).numpy()) 5.0

Traits: SameOperandsAndResultShape

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute
Tout ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of 128-bit complex or 64-bit complex values

Results:

Result Description
y tensor of 32/64-bit float values

tf.Complex (::mlir::TF::ComplexOp)

Converts two real numbers to a complex number.

Given a tensor real representing the real part of a complex number, and a tensor imag representing the imaginary part of a complex number, this operation returns complex numbers elementwise of the form \(a + bj\), where a represents the real part and b represents the imag part.

The input tensors real and imag must have the same shape.

For example:

# tensor 'real' is [2.25, 3.25]
# tensor `imag` is [4.75, 5.75]
tf.complex(real, imag) ==> [[2.25 + 4.75j], [3.25 + 5.75j]]

Traits: ResultsBroadcastableShape

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute
Tout ::mlir::Attribute derived attribute

Operands:

Operand Description
real tensor of 32/64-bit float values
imag tensor of 32/64-bit float values

Results:

Result Description
out tensor of 128-bit complex or 64-bit complex values

tf.ConcatOffset (::mlir::TF::ConcatOffsetOp)

Computes offsets of concat inputs within its output.

For example:

# 'x' is [2, 2, 7]
# 'y' is [2, 3, 7]
# 'z' is [2, 5, 7]
concat_offset(2, [x, y, z]) => [0, 0, 0], [0, 2, 0], [0, 5, 0]

This is typically used by gradient computations for a concat operation.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
N ::mlir::Attribute derived attribute

Operands:

Operand Description
concat_dim tensor of 32-bit integer values
shape tensor of 32-bit integer values

Results:

Result Description
offset tensor of 32-bit integer values

tf.Concat (::mlir::TF::ConcatOp)

Concatenates tensors along one dimension.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
N ::mlir::Attribute derived attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
concat_dim tensor of 32-bit integer values
values tensor of tf.dtype values

Results:

Result Description
output tensor of tf.dtype values

tf.ConcatV2 (::mlir::TF::ConcatV2Op)

Concatenates tensors along one dimension.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
N ::mlir::Attribute derived attribute
T ::mlir::Attribute derived attribute
Tidx ::mlir::Attribute derived attribute

Operands:

Operand Description
values tensor of tf.dtype values
axis tensor of 32/64-bit signed integer values

Results:

Result Description
output tensor of tf.dtype values

tf.ConfigureAndInitializeGlobalTPU (::mlir::TF::ConfigureAndInitializeGlobalTPUOp)

An op that initialize the TPU system in a multi-client set up.

Initializes global TPU system for mutli-client execution.

This op does the work of both ConfigureDistributedTpuOp and InitializeHostForDistributedTpuOp, and outputs the latter's result.

Results:

Result Description
output tensor of 32-bit integer values

tf.ConfigureDistributedTPU (::mlir::TF::ConfigureDistributedTPUOp)

Sets up the centralized structures for a distributed TPU system.

Attributes:

Attribute MLIR Type Description
embedding_config ::mlir::StringAttr string attribute
tpu_embedding_config ::mlir::StringAttr string attribute
is_global_init ::mlir::BoolAttr bool attribute
enable_whole_mesh_compilations ::mlir::BoolAttr bool attribute
compilation_failure_closes_chips ::mlir::BoolAttr bool attribute
tpu_cancellation_closes_chips ::mlir::IntegerAttr 64-bit signless integer attribute

Results:

Result Description
topology tensor of string values

tf.ConfigureTPUEmbedding (::mlir::TF::ConfigureTPUEmbeddingOp)

Sets up TPUEmbedding in a distributed TPU system.

Attributes:

Attribute MLIR Type Description
config ::mlir::StringAttr string attribute

tf.Conj (::mlir::TF::ConjOp)

Returns the complex conjugate of a complex number.

Given a tensor input of complex numbers, this operation returns a tensor of complex numbers that are the complex conjugate of each element in input. The complex numbers in input must be of the form \(a + bj\), where a is the real part and b is the imaginary part.

The complex conjugate returned by this operation is of the form \(a - bj\).

For example:

# tensor 'input' is [-2.25 + 4.75j, 3.25 + 5.75j]
tf.conj(input) ==> [-2.25 - 4.75j, 3.25 - 5.75j]

Traits: Involution, SameOperandsAndResultType

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of 128-bit complex or 64-bit complex or variant values

Results:

Result Description
output tensor of 128-bit complex or 64-bit complex or variant values

tf.ConjugateTranspose (::mlir::TF::ConjugateTransposeOp)

Shuffle dimensions of x according to a permutation and conjugate the result.

The output y has the same rank as x. The shapes of x and y satisfy: y.shape[i] == x.shape[perm[i]] for i in [0, 1, ..., rank(x) - 1] y[i,j,k,...,s,t,u] == conj(x[perm[i], perm[j], perm[k],...,perm[s], perm[t], perm[u]])

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute
Tperm ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of tf.dtype values
perm tensor of 32/64-bit signed integer values

Results:

Result Description
y tensor of tf.dtype values

tf.Const (::mlir::TF::ConstOp)

Constant tensor op

Traits: ConstantLike

Interfaces: InferTypeOpInterface, NoSideEffect (MemoryEffectOpInterface), OpAsmOpInterface

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
value ::mlir::ElementsAttr constant vector/tensor attribute
dtype ::mlir::Attribute derived attribute

Results:

Result Description
output tensor of tf.dtype values

tf.Conv2DBackpropFilter (::mlir::TF::Conv2DBackpropFilterOp)

Computes the gradients of convolution with respect to the filter.

Interfaces: NoSideEffect (MemoryEffectOpInterface), TF_LayoutSensitiveInterface

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
strides ::mlir::ArrayAttr 64-bit integer array attribute
use_cudnn_on_gpu ::mlir::BoolAttr bool attribute
padding ::mlir::StringAttr string attribute whose value is SAME, or VALID, or EXPLICIT
explicit_paddings ::mlir::ArrayAttr 64-bit integer array attribute
data_format ::mlir::StringAttr 'NHWC' or 'NCHW' convnet data format
dilations ::mlir::ArrayAttr 64-bit integer array attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of floating-point values
filter_sizes tensor of 32-bit integer values
out_backprop tensor of floating-point values

Results:

Result Description
output tensor of floating-point values

tf.Conv2DBackpropInput (::mlir::TF::Conv2DBackpropInputOp)

Computes the gradients of convolution with respect to the input.

Interfaces: NoSideEffect (MemoryEffectOpInterface), TF_LayoutSensitiveInterface

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
strides ::mlir::ArrayAttr 64-bit integer array attribute
use_cudnn_on_gpu ::mlir::BoolAttr bool attribute
padding ::mlir::StringAttr string attribute whose value is SAME, or VALID, or EXPLICIT
explicit_paddings ::mlir::ArrayAttr 64-bit integer array attribute
data_format ::mlir::StringAttr 'NHWC' or 'NCHW' convnet data format
dilations ::mlir::ArrayAttr 64-bit integer array attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input_sizes tensor of 32-bit integer values
filter tensor of bfloat16 or 16-bit float or 32-bit float or 64-bit float or 32-bit integer values
out_backprop tensor of bfloat16 or 16-bit float or 32-bit float or 64-bit float or 32-bit integer values

Results:

Result Description
output tensor of bfloat16 or 16-bit float or 32-bit float or 64-bit float or 32-bit integer values

tf.Conv2D (::mlir::TF::Conv2DOp)

Computes a 2-D convolution given 4-D input and filter tensors.

Given an input tensor of shape [batch, in_height, in_width, in_channels] and a filter / kernel tensor of shape [filter_height, filter_width, in_channels, out_channels], this op performs the following:

  1. Flattens the filter to a 2-D matrix with shape [filter_height * filter_width * in_channels, output_channels].
  2. Extracts image patches from the input tensor to form a virtual tensor of shape [batch, out_height, out_width, filter_height * filter_width * in_channels].
  3. For each patch, right-multiplies the filter matrix and the image patch vector.

In detail, with the default NHWC format,

output[b, i, j, k] =
    sum_{di, dj, q} input[b, strides[1] * i + di, strides[2] * j + dj, q] *
                    filter[di, dj, q, k]

Must have strides[0] = strides[3] = 1. For the most common case of the same horizontal and vertices strides, strides = [1, stride, stride, 1].

Interfaces: InferTypeOpInterface, NoSideEffect (MemoryEffectOpInterface), TF_LayoutSensitiveInterface

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
strides ::mlir::ArrayAttr 64-bit integer array attribute
use_cudnn_on_gpu ::mlir::BoolAttr bool attribute
padding ::mlir::StringAttr string attribute whose value is SAME, or VALID, or EXPLICIT
explicit_paddings ::mlir::ArrayAttr 64-bit integer array attribute
data_format ::mlir::StringAttr 'NHWC' or 'NCHW' convnet data format
dilations ::mlir::ArrayAttr 64-bit integer array attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of bfloat16 or 16-bit float or 32-bit float or 64-bit float or 32-bit integer values
filter tensor of bfloat16 or 16-bit float or 32-bit float or 64-bit float or 32-bit integer values

Results:

Result Description
output tensor of bfloat16 or 16-bit float or 32-bit float or 64-bit float or 32-bit integer values

tf.Conv3DBackpropFilterV2 (::mlir::TF::Conv3DBackpropFilterV2Op)

Computes the gradients of 3-D convolution with respect to the filter.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
strides ::mlir::ArrayAttr 64-bit integer array attribute with at least 5 elements
padding ::mlir::StringAttr string attribute whose value is SAME, or VALID
data_format ::mlir::StringAttr string attribute whose value is NDHWC, or NCDHW
dilations ::mlir::ArrayAttr 64-bit integer array attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of floating-point values
filter_sizes tensor of 32-bit integer values
out_backprop tensor of floating-point values

Results:

Result Description
output tensor of floating-point values

tf.Conv3DBackpropInputV2 (::mlir::TF::Conv3DBackpropInputV2Op)

Computes the gradients of 3-D convolution with respect to the input.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
strides ::mlir::ArrayAttr 64-bit integer array attribute with at least 5 elements
padding ::mlir::StringAttr string attribute whose value is SAME, or VALID
data_format ::mlir::StringAttr string attribute whose value is NDHWC, or NCDHW
dilations ::mlir::ArrayAttr 64-bit integer array attribute
T ::mlir::Attribute derived attribute
Tshape ::mlir::Attribute derived attribute

Operands:

Operand Description
input_sizes tensor of 32/64-bit signed integer values
filter tensor of floating-point values
out_backprop tensor of floating-point values

Results:

Result Description
output tensor of floating-point values

tf.Conv3D (::mlir::TF::Conv3DOp)

Computes a 3-D convolution given 5-D input and filter tensors.

In signal processing, cross-correlation is a measure of similarity of two waveforms as a function of a time-lag applied to one of them. This is also known as a sliding dot product or sliding inner-product.

Our Conv3D implements a form of cross-correlation.

Interfaces: InferTypeOpInterface, NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
strides ::mlir::ArrayAttr 64-bit integer array attribute with at least 5 elements
padding ::mlir::StringAttr string attribute whose value is SAME, or VALID
data_format ::mlir::StringAttr string attribute whose value is NDHWC, or NCDHW
dilations ::mlir::ArrayAttr 64-bit integer array attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of floating-point values
filter tensor of floating-point values

Results:

Result Description
output tensor of floating-point values

tf.Cos (::mlir::TF::CosOp)

Computes cos of x element-wise.

Given an input tensor, this function computes cosine of every element in the tensor. Input range is (-inf, inf) and output range is [-1,1]. If input lies outside the boundary, nan is returned.

  x = tf.constant([-float("inf"), -9, -0.5, 1, 1.2, 200, 10000, float("inf")])
  tf.math.cos(x) ==> [nan -0.91113025 0.87758255 0.5403023 0.36235774 0.48718765 -0.95215535 nan]

Traits: TF_SameOperandsAndResultTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of floating-point or complex values

Results:

Result Description
y tensor of floating-point or complex values

tf.Cosh (::mlir::TF::CoshOp)

Computes hyperbolic cosine of x element-wise.

Given an input tensor, this function computes hyperbolic cosine of every element in the tensor. Input range is [-inf, inf] and output range is [1, inf].

  x = tf.constant([-float("inf"), -9, -0.5, 1, 1.2, 2, 10, float("inf")])
  tf.math.cosh(x) ==> [inf 4.0515420e+03 1.1276259e+00 1.5430807e+00 1.8106556e+00 3.7621956e+00 1.1013233e+04 inf]

Traits: TF_SameOperandsAndResultTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of floating-point or complex values

Results:

Result Description
y tensor of floating-point or complex values

tf.CreateSummaryDbWriter (::mlir::TF::CreateSummaryDbWriterOp)

Creates summary database writer accessible by given resource handle.

This can be used to write tensors from the execution graph directly to a database. Only SQLite is supported right now. This function will create the schema if it doesn't exist. Entries in the Users, Experiments, and Runs tables will be created automatically if they don't already exist.

writer: Handle to SummaryWriter resource to overwrite. db_uri: For example "file:/tmp/foo.sqlite". experiment_name: Can't contain ASCII control characters or <>. Case sensitive. If empty, then the Run will not be associated with any Experiment. run_name: Can't contain ASCII control characters or <>. Case sensitive. If empty, then each Tag will not be associated with any Run. user_name: Must be valid as both a DNS label and Linux username. If empty, then the Experiment will not be associated with any User.

Operands:

Operand Description
writer tensor of resource values
db_uri tensor of string values
experiment_name tensor of string values
run_name tensor of string values
user_name tensor of string values

tf.CreateSummaryFileWriter (::mlir::TF::CreateSummaryFileWriterOp)

Creates a summary file writer accessible by the given resource handle.

writer: A handle to the summary writer resource logdir: Directory where the event file will be written. max_queue: Size of the queue of pending events and summaries. flush_millis: How often, in milliseconds, to flush the pending events and summaries to disk. filename_suffix: Every event file's name is suffixed with this suffix.

Operands:

Operand Description
writer tensor of resource values
logdir tensor of string values
max_queue tensor of 32-bit integer values
flush_millis tensor of 32-bit integer values
filename_suffix tensor of string values

tf.Cross (::mlir::TF::CrossOp)

Compute the pairwise cross product.

a and b must be the same shape; they can either be simple 3-element vectors, or any shape where the innermost dimension is 3. In the latter case, each pair of corresponding 3-element vectors is cross-multiplied independently.

Traits: SameOperandsAndResultType

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
a tensor of integer or floating-point values
b tensor of integer or floating-point values

Results:

Result Description
product tensor of integer or floating-point values

tf.CrossReplicaSum (::mlir::TF::CrossReplicaSumOp)

An Op to sum inputs across replicated TPU instances.

Each instance supplies its own input.

For example, suppose there are 8 TPU instances: [A, B, C, D, E, F, G, H]. Passing group_assignment=[[0,2,4,6],[1,3,5,7]] sets A, C, E, G as group 0, and B, D, F, H as group 1. Thus we get the outputs: [A+C+E+G, B+D+F+H, A+C+E+G, B+D+F+H, A+C+E+G, B+D+F+H, A+C+E+G, B+D+F+H].

Traits: TF_NoConstantFold

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of bfloat16 or 16-bit float or 32-bit float or 64-bit float or 32-bit integer or 32-bit unsigned integer values
group_assignment tensor of 32-bit integer values

Results:

Result Description
output tensor of bfloat16 or 16-bit float or 32-bit float or 64-bit float or 32-bit integer or 32-bit unsigned integer values

tf.Cumprod (::mlir::TF::CumprodOp)

Compute the cumulative product of the tensor x along axis.

By default, this op performs an inclusive cumprod, which means that the first element of the input is identical to the first element of the output:

tf.cumprod([a, b, c])  # => [a, a * b, a * b * c]

By setting the exclusive kwarg to True, an exclusive cumprod is performed instead:

tf.cumprod([a, b, c], exclusive=True)  # => [1, a, a * b]

By setting the reverse kwarg to True, the cumprod is performed in the opposite direction:

tf.cumprod([a, b, c], reverse=True)  # => [a * b * c, b * c, c]

This is more efficient than using separate tf.reverse ops.

The reverse and exclusive kwargs can also be combined:

tf.cumprod([a, b, c], exclusive=True, reverse=True)  # => [b * c, c, 1]

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
exclusive ::mlir::BoolAttr bool attribute
reverse ::mlir::BoolAttr bool attribute
T ::mlir::Attribute derived attribute
Tidx ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values
axis tensor of 32/64-bit signed integer values

Results:

Result Description
out tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

tf.Cumsum (::mlir::TF::CumsumOp)

Compute the cumulative sum of the tensor x along axis.

By default, this op performs an inclusive cumsum, which means that the first element of the input is identical to the first element of the output:

tf.cumsum([a, b, c])  # => [a, a + b, a + b + c]

By setting the exclusive kwarg to True, an exclusive cumsum is performed instead:

tf.cumsum([a, b, c], exclusive=True)  # => [0, a, a + b]

By setting the reverse kwarg to True, the cumsum is performed in the opposite direction:

tf.cumsum([a, b, c], reverse=True)  # => [a + b + c, b + c, c]

This is more efficient than using separate tf.reverse ops.

The reverse and exclusive kwargs can also be combined:

tf.cumsum([a, b, c], exclusive=True, reverse=True)  # => [b + c, c, 0]

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
exclusive ::mlir::BoolAttr bool attribute
reverse ::mlir::BoolAttr bool attribute
T ::mlir::Attribute derived attribute
Tidx ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values
axis tensor of 32/64-bit signed integer values

Results:

Result Description
out tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

tf.DataFormatDimMap (::mlir::TF::DataFormatDimMapOp)

Returns the dimension index in the destination data format given the one in

the source data format.

Traits: TF_SameOperandsAndResultTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
src_format ::mlir::StringAttr string attribute
dst_format ::mlir::StringAttr string attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of 32/64-bit signed integer values

Results:

Result Description
y tensor of 32/64-bit signed integer values

tf.DataFormatVecPermute (::mlir::TF::DataFormatVecPermuteOp)

Permute input tensor from src_format to dst_format.

Input tensor must be a vector of size 4, or a 4x2 tensor.

For example, with src_format of NHWC, dst_format of NCHW, and inputs:

[1, 2, 3, 4]

and

[[1, 2, 3, 4],
 [5, 6, 7, 8]]

, the outputs will be (respectively):

[1, 4, 2, 3]

and

[[1, 4, 2, 3],
 [5, 8, 6, 7]]

Traits: SameOperandsAndResultType

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
src_format ::mlir::StringAttr string attribute
dst_format ::mlir::StringAttr string attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of 32/64-bit signed integer values

Results:

Result Description
y tensor of 32/64-bit signed integer values

tf.DebugIdentityV2 (::mlir::TF::DebugIdentityV2Op)

Debug Identity V2 Op.

Provides an identity mapping from input to output, while writing the content of the input tensor by calling DebugEventsWriter.

The semantics of the input tensor depends on tensor_debug_mode. In typical usage, the input tensor comes directly from the user computation only when graph_debug_mode is FULL_TENSOR (see protobuf/debug_event.proto for a list of all the possible values of graph_debug_mode). For the other debug modes, the input tensor should be produced by an additional op or subgraph that computes summary information about one or more tensors.

Attributes:

Attribute MLIR Type Description
tfdbg_context_id ::mlir::StringAttr string attribute
op_name ::mlir::StringAttr string attribute
output_slot ::mlir::IntegerAttr 64-bit signless integer attribute
tensor_debug_mode ::mlir::IntegerAttr 64-bit signless integer attribute
debug_urls ::mlir::ArrayAttr string array attribute
circular_buffer_size ::mlir::IntegerAttr 64-bit signless integer attribute
tfdbg_run_id ::mlir::StringAttr string attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of tf.dtype values

Results:

Result Description
output tensor of tf.dtype values

tf.DecodeAndCropJpeg (::mlir::TF::DecodeAndCropJpegOp)

Decode and Crop a JPEG-encoded image to a uint8 tensor.

The attr channels indicates the desired number of color channels for the decoded image.

Accepted values are:

  • 0: Use the number of channels in the JPEG-encoded image.
  • 1: output a grayscale image.
  • 3: output an RGB image.

If needed, the JPEG-encoded image is transformed to match the requested number of color channels.

The attr ratio allows downscaling the image by an integer factor during decoding. Allowed values are: 1, 2, 4, and 8. This is much faster than downscaling the image later.

It is equivalent to a combination of decode and crop, but much faster by only decoding partial jpeg image.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
channels ::mlir::IntegerAttr 64-bit signless integer attribute
ratio ::mlir::IntegerAttr 64-bit signless integer attribute
fancy_upscaling ::mlir::BoolAttr bool attribute
try_recover_truncated ::mlir::BoolAttr bool attribute
acceptable_fraction ::mlir::FloatAttr 32-bit float attribute
dct_method ::mlir::StringAttr string attribute

Operands:

Operand Description
contents tensor of string values
crop_window tensor of 32-bit integer values

Results:

Result Description
image tensor of 8-bit unsigned integer values

tf.DecodeGif (::mlir::TF::DecodeGifOp)

Decode the frame(s) of a GIF-encoded image to a uint8 tensor.

GIF images with frame or transparency compression are not supported. On Linux and MacOS systems, convert animated GIFs from compressed to uncompressed by running:

convert \\(src.gif -coalesce \\)dst.gif

This op also supports decoding JPEGs and PNGs, though it is cleaner to use tf.io.decode_image.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

Operand Description
contents tensor of string values

Results:

Result Description
image tensor of 8-bit unsigned integer values

tf.DecodeJpeg (::mlir::TF::DecodeJpegOp)

Decode a JPEG-encoded image to a uint8 tensor.

The attr channels indicates the desired number of color channels for the decoded image.

Accepted values are:

  • 0: Use the number of channels in the JPEG-encoded image.
  • 1: output a grayscale image.
  • 3: output an RGB image.

If needed, the JPEG-encoded image is transformed to match the requested number of color channels.

The attr ratio allows downscaling the image by an integer factor during decoding. Allowed values are: 1, 2, 4, and 8. This is much faster than downscaling the image later.

This op also supports decoding PNGs and non-animated GIFs since the interface is the same, though it is cleaner to use tf.io.decode_image.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
channels ::mlir::IntegerAttr 64-bit signless integer attribute
ratio ::mlir::IntegerAttr 64-bit signless integer attribute
fancy_upscaling ::mlir::BoolAttr bool attribute
try_recover_truncated ::mlir::BoolAttr bool attribute
acceptable_fraction ::mlir::FloatAttr 32-bit float attribute
dct_method ::mlir::StringAttr string attribute

Operands:

Operand Description
contents tensor of string values

Results:

Result Description
image tensor of 8-bit unsigned integer values

tf.DecodePaddedRaw (::mlir::TF::DecodePaddedRawOp)

Reinterpret the bytes of a string as a vector of numbers.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
little_endian ::mlir::BoolAttr bool attribute
out_type ::mlir::Attribute derived attribute

Operands:

Operand Description
input_bytes tensor of string values
fixed_length tensor of 32-bit integer values

Results:

Result Description
output tensor of bfloat16 or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 16-bit unsigned integer or 8-bit unsigned integer values

tf.DecodePng (::mlir::TF::DecodePngOp)

Decode a PNG-encoded image to a uint8 or uint16 tensor.

The attr channels indicates the desired number of color channels for the decoded image.

Accepted values are:

  • 0: Use the number of channels in the PNG-encoded image.
  • 1: output a grayscale image.
  • 3: output an RGB image.
  • 4: output an RGBA image.

If needed, the PNG-encoded image is transformed to match the requested number of color channels.

This op also supports decoding JPEGs and non-animated GIFs since the interface is the same, though it is cleaner to use tf.io.decode_image.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
channels ::mlir::IntegerAttr 64-bit signless integer attribute
dtype ::mlir::Attribute derived attribute

Operands:

Operand Description
contents tensor of string values

Results:

Result Description
image tensor of 16-bit unsigned integer or 8-bit unsigned integer values

tf.DeleteIterator (::mlir::TF::DeleteIteratorOp)

A container for an iterator resource.

Operands:

Operand Description
handle tensor of resource values
deleter tensor of variant values

tf.DeleteMemoryCache (::mlir::TF::DeleteMemoryCacheOp)

Operands:

Operand Description
handle tensor of resource values
deleter tensor of variant values

tf.DeleteMultiDeviceIterator (::mlir::TF::DeleteMultiDeviceIteratorOp)

A container for an iterator resource.

Attributes:

Attribute MLIR Type Description
N ::mlir::Attribute derived attribute

Operands:

Operand Description
multi_device_iterator tensor of resource values
iterators tensor of resource values
deleter tensor of variant values

tf.DeleteRandomSeedGenerator (::mlir::TF::DeleteRandomSeedGeneratorOp)

Operands:

Operand Description
handle tensor of resource values
deleter tensor of variant values

tf.DeleteSeedGenerator (::mlir::TF::DeleteSeedGeneratorOp)

Operands:

Operand Description
handle tensor of resource values
deleter tensor of variant values

tf.DepthToSpace (::mlir::TF::DepthToSpaceOp)

DepthToSpace for tensors of type T.

Rearranges data from depth into blocks of spatial data. This is the reverse transformation of SpaceToDepth. More specifically, this op outputs a copy of the input tensor where values from the depth dimension are moved in spatial blocks to the height and width dimensions. The attr block_size indicates the input block size and how the data is moved.

  • Chunks of data of size block_size * block_size from depth are rearranged into non-overlapping blocks of size block_size x block_size
  • The width the output tensor is input_depth * block_size, whereas the height is input_height * block_size.
  • The Y, X coordinates within each block of the output image are determined by the high order component of the input channel index.
  • The depth of the input tensor must be divisible by block_size * block_size.

The data_format attr specifies the layout of the input and output tensors with the following options: "NHWC": [ batch, height, width, channels ] "NCHW": [ batch, channels, height, width ] "NCHW_VECT_C": qint8 [ batch, channels / 4, height, width, 4 ]

It is useful to consider the operation as transforming a 6-D Tensor. e.g. for data_format = NHWC, Each element in the input tensor can be specified via 6 coordinates, ordered by decreasing memory layout significance as: n,iY,iX,bY,bX,oC (where n=batch index, iX, iY means X or Y coordinates within the input image, bX, bY means coordinates within the output block, oC means output channels). The output would be the input transposed to the following layout: n,iY,bY,iX,bX,oC

This operation is useful for resizing the activations between convolutions (but keeping all data), e.g. instead of pooling. It is also useful for training purely convolutional models.

For example, given an input of shape [1, 1, 1, 4], data_format = "NHWC" and block_size = 2:

x = [[[[1, 2, 3, 4]]]]

This operation will output a tensor of shape [1, 2, 2, 1]:

   [[[[1], [2]],
     [[3], [4]]]]

Here, the input has a batch of 1 and each batch element has shape [1, 1, 4], the corresponding output will have 2x2 elements and will have a depth of 1 channel (1 = 4 / (block_size * block_size)). The output element shape is [2, 2, 1].

For an input tensor with larger depth, here of shape [1, 1, 1, 12], e.g.

x = [[[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]]]

This operation, for block size of 2, will return the following tensor of shape [1, 2, 2, 3]

   [[[[1, 2, 3], [4, 5, 6]],
     [[7, 8, 9], [10, 11, 12]]]]

Similarly, for the following input of shape [1 2 2 4], and a block size of 2:

x =  [[[[1, 2, 3, 4],
       [5, 6, 7, 8]],
      [[9, 10, 11, 12],
       [13, 14, 15, 16]]]]

the operator will return the following tensor of shape [1 4 4 1]:

x = [[[ [1],   [2],  [5],  [6]],
      [ [3],   [4],  [7],  [8]],
      [ [9],  [10], [13],  [14]],
      [ [11], [12], [15],  [16]]]]

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
block_size ::mlir::IntegerAttr 64-bit signless integer attribute whose minimum value is 2
data_format ::mlir::StringAttr string attribute whose value is NHWC, or NCHW, or NCHW_VECT_C
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of tf.dtype values

Results:

Result Description
output tensor of tf.dtype values

tf.DepthwiseConv2dNativeBackpropFilter (::mlir::TF::DepthwiseConv2dNativeBackpropFilterOp)

Computes the gradients of depthwise convolution with respect to the filter.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
strides ::mlir::ArrayAttr 64-bit integer array attribute
padding ::mlir::StringAttr string attribute whose value is SAME, or VALID, or EXPLICIT
explicit_paddings ::mlir::ArrayAttr 64-bit integer array attribute
data_format ::mlir::StringAttr 'NHWC' or 'NCHW' convnet data format
dilations ::mlir::ArrayAttr 64-bit integer array attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of floating-point values
filter_sizes tensor of 32-bit integer values
out_backprop tensor of floating-point values

Results:

Result Description
output tensor of floating-point values

tf.DepthwiseConv2dNativeBackpropInput (::mlir::TF::DepthwiseConv2dNativeBackpropInputOp)

Computes the gradients of depthwise convolution with respect to the input.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
strides ::mlir::ArrayAttr 64-bit integer array attribute
padding ::mlir::StringAttr string attribute whose value is SAME, or VALID, or EXPLICIT
explicit_paddings ::mlir::ArrayAttr 64-bit integer array attribute
data_format ::mlir::StringAttr 'NHWC' or 'NCHW' convnet data format
dilations ::mlir::ArrayAttr 64-bit integer array attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input_sizes tensor of 32-bit integer values
filter tensor of floating-point values
out_backprop tensor of floating-point values

Results:

Result Description
output tensor of floating-point values

tf.DepthwiseConv2dNative (::mlir::TF::DepthwiseConv2dNativeOp)

Computes a 2-D depthwise convolution given 4-D input and filter tensors.

Given an input tensor of shape [batch, in_height, in_width, in_channels] and a filter / kernel tensor of shape [filter_height, filter_width, in_channels, channel_multiplier], containing in_channels convolutional filters of depth 1, depthwise_conv2d applies a different filter to each input channel (expanding from 1 channel to channel_multiplier channels for each), then concatenates the results together. Thus, the output has in_channels * channel_multiplier channels.

for k in 0..in_channels-1
  for q in 0..channel_multiplier-1
    output[b, i, j, k * channel_multiplier + q] =
      sum_{di, dj} input[b, strides[1] * i + di, strides[2] * j + dj, k] *
                        filter[di, dj, k, q]

Must have strides[0] = strides[3] = 1. For the most common case of the same horizontal and vertices strides, strides = [1, stride, stride, 1].

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
strides ::mlir::ArrayAttr 64-bit integer array attribute
padding ::mlir::StringAttr string attribute whose value is SAME, or VALID, or EXPLICIT
explicit_paddings ::mlir::ArrayAttr 64-bit integer array attribute
data_format ::mlir::StringAttr 'NHWC' or 'NCHW' convnet data format
dilations ::mlir::ArrayAttr 64-bit integer array attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of floating-point values
filter tensor of floating-point values

Results:

Result Description
output tensor of floating-point values

tf.Dequantize (::mlir::TF::DequantizeOp)

Dequantize the 'input' tensor into a float or bfloat16 Tensor.

[min_range, max_range] are scalar floats that specify the range for the output. The 'mode' attribute controls exactly which calculations are used to convert the float values to their quantized equivalents.

In 'MIN_COMBINED' mode, each value of the tensor will undergo the following:

if T == qint8: in[i] += (range(T) + 1)/ 2.0
out[i] = min_range + (in[i]* (max_range - min_range) / range(T))

here range(T) = numeric_limits<T>::max() - numeric_limits<T>::min()

MIN_COMBINED Mode Example

If the input comes from a QuantizedRelu6, the output type is quint8 (range of 0-255) but the possible range of QuantizedRelu6 is 0-6. The min_range and max_range values are therefore 0.0 and 6.0. Dequantize on quint8 will take each value, cast to float, and multiply by 6 / 255. Note that if quantizedtype is qint8, the operation will additionally add each value by 128 prior to casting.

If the mode is 'MIN_FIRST', then this approach is used:

num_discrete_values = 1 << (# of bits in T)
range_adjust = num_discrete_values / (num_discrete_values - 1)
range = (range_max - range_min) * range_adjust
range_scale = range / num_discrete_values
const double offset_input = static_cast<double>(input) - lowest_quantized;
result = range_min + ((input - numeric_limits<T>::min()) * range_scale)

If the mode is SCALED, dequantization is performed by multiplying each input value by a scaling_factor. (Thus an input of 0 always maps to 0.0).

The scaling_factor is determined from min_range, max_range, and narrow_range in a way that is compatible with QuantizeAndDequantize{V2|V3} and QuantizeV2, using the following algorithm:


  const int min_expected_T = std::numeric_limits<T>::min() +
    (narrow_range ? 1 : 0);
  const int max_expected_T = std::numeric_limits<T>::max();
  const float max_expected_T = std::numeric_limits<float>::max();

  const float scale_factor =
    (std::numeric_limits<T>::min() == 0) ? (max_range / max_expected_T)
                                         : std::max(min_range / min_expected_T,
                                                    max_range / max_expected_T);

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
mode ::mlir::StringAttr string attribute whose value is MIN_COMBINED, or MIN_FIRST, or SCALED
narrow_range ::mlir::BoolAttr bool attribute
axis ::mlir::IntegerAttr 64-bit signless integer attribute
T ::mlir::Attribute derived attribute
dtype ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of 16-bit quantized integer or 32-bit quantized integer or 8-bit quantized integer or 16-bit quantized unsigned integer or 8-bit quantized unsigned integer values
min_range tensor of 32-bit float values
max_range tensor of 32-bit float values

Results:

Result Description
output tensor of bfloat16 or 32-bit float values

tf.DeserializeIterator (::mlir::TF::DeserializeIteratorOp)

Converts the given variant tensor to an iterator and stores it in the given resource.

Operands:

Operand Description
resource_handle tensor of resource values
serialized tensor of variant values

tf.DeserializeSparse (::mlir::TF::DeserializeSparseOp)

Deserialize SparseTensor objects.

The input serialized_sparse must have the shape [?, ?, ..., ?, 3] where the last dimension stores serialized SparseTensor objects and the other N dimensions (N >= 0) correspond to a batch. The ranks of the original SparseTensor objects must all match. When the final SparseTensor is created, its rank is the rank of the incoming SparseTensor objects plus N; the sparse tensors have been concatenated along new dimensions, one for each batch.

The output SparseTensor object's shape values for the original dimensions are the max across the input SparseTensor objects' shape values for the corresponding dimensions. The new dimensions match the size of the batch.

The input SparseTensor objects' indices are assumed ordered in standard lexicographic order. If this is not the case, after this step run SparseReorder to restore index ordering.

For example, if the serialized input is a [2 x 3] matrix representing two original SparseTensor objects:

index = [ 0]
        [10]
        [20]
values = [1, 2, 3]
shape = [50]

and

index = [ 2]
        [10]
values = [4, 5]
shape = [30]

then the final deserialized SparseTensor will be:

index = [0  0]
        [0 10]
        [0 20]
        [1  2]
        [1 10]
values = [1, 2, 3, 4, 5]
shape = [2 50]

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
Tserialized ::mlir::Attribute derived attribute
dtype ::mlir::Attribute derived attribute

Operands:

Operand Description
serialized_sparse tensor of string or variant values

Results:

Result Description
sparse_indices tensor of 64-bit integer values
sparse_values tensor of tf.dtype values
sparse_shape tensor of 64-bit integer values

tf.DestroyResourceOp (::mlir::TF::DestroyResourceOp)

Deletes the resource specified by the handle.

All subsequent operations using the resource will result in a NotFound error status.

Attributes:

Attribute MLIR Type Description
ignore_lookup_error ::mlir::BoolAttr bool attribute

Operands:

Operand Description
resource tensor of resource values

tf.DeviceIndex (::mlir::TF::DeviceIndexOp)

Return the index of device the op runs.

Given a list of device names, this operation returns the index of the device this op runs. The length of the list is returned in two cases: (1) Device does not exist in the given device list. (2) It is in XLA compilation.

Traits: TF_NoConstantFold

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
device_names ::mlir::ArrayAttr string array attribute

Results:

Result Description
index tensor of 32-bit integer values

tf.Diag (::mlir::TF::DiagOp)

Returns a diagonal tensor with a given diagonal values.

Given a diagonal, this operation returns a tensor with the diagonal and everything else padded with zeros. The diagonal is computed as follows:

Assume diagonal has dimensions [D1,..., Dk], then the output is a tensor of rank 2k with dimensions [D1,..., Dk, D1,..., Dk] where:

output[i1,..., ik, i1,..., ik] = diagonal[i1, ..., ik] and 0 everywhere else.

For example:

# 'diagonal' is [1, 2, 3, 4]
tf.diag(diagonal) ==> [[1, 0, 0, 0]
                       [0, 2, 0, 0]
                       [0, 0, 3, 0]
                       [0, 0, 0, 4]]

Traits: TF_SameOperandsAndResultElementTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
diagonal tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 32-bit integer or 64-bit integer values

Results:

Result Description
output tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 32-bit integer or 64-bit integer values

tf.DiagPart (::mlir::TF::DiagPartOp)

Returns the diagonal part of the tensor.

This operation returns a tensor with the diagonal part of the input. The diagonal part is computed as follows:

Assume input has dimensions [D1,..., Dk, D1,..., Dk], then the output is a tensor of rank k with dimensions [D1,..., Dk] where:

diagonal[i1,..., ik] = input[i1, ..., ik, i1,..., ik].

For example:

# 'input' is [[1, 0, 0, 0]
              [0, 2, 0, 0]
              [0, 0, 3, 0]
              [0, 0, 0, 4]]

tf.diag_part(input) ==> [1, 2, 3, 4]

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 32-bit integer or 64-bit integer values

Results:

Result Description
diagonal tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 32-bit integer or 64-bit integer values

tf.Digamma (::mlir::TF::DigammaOp)

Computes Psi, the derivative of Lgamma (the log of the absolute value of

Gamma(x)), element-wise.

Traits: TF_SameOperandsAndResultTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of floating-point values

Results:

Result Description
y tensor of floating-point values

tf.DivNoNan (::mlir::TF::DivNoNanOp)

Returns 0 if the denominator is zero.

Traits: ResultsBroadcastableShape, TF_SameOperandsAndResultElementTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of floating-point or complex values
y tensor of floating-point or complex values

Results:

Result Description
z tensor of floating-point or complex values

tf.Div (::mlir::TF::DivOp)

Returns x / y element-wise.

Traits: ResultsBroadcastableShape, TF_SameOperandsAndResultElementTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values
y tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

Results:

Result Description
z tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

tf.DummyMemoryCache (::mlir::TF::DummyMemoryCacheOp)

Results:

Result Description
handle tensor of resource values

tf.DummySeedGenerator (::mlir::TF::DummySeedGeneratorOp)

Results:

Result Description
handle tensor of resource values

tf.DynamicStitch (::mlir::TF::DynamicStitchOp)

Interleave the values from the data tensors into a single tensor.

Builds a merged tensor such that

    merged[indices[m][i, ..., j], ...] = data[m][i, ..., j, ...]

For example, if each indices[m] is scalar or vector, we have

    # Scalar indices:
    merged[indices[m], ...] = data[m][...]

    # Vector indices:
    merged[indices[m][i], ...] = data[m][i, ...]

Each data[i].shape must start with the corresponding indices[i].shape, and the rest of data[i].shape must be constant w.r.t. i. That is, we must have data[i].shape = indices[i].shape + constant. In terms of this constant, the output shape is

merged.shape = [max(indices)] + constant

Values are merged in order, so if an index appears in both indices[m][i] and indices[n][j] for (m,i) < (n,j) the slice data[n][j] will appear in the merged result. If you do not need this guarantee, ParallelDynamicStitch might perform better on some devices.

For example:

    indices[0] = 6
    indices[1] = [4, 1]
    indices[2] = [[5, 2], [0, 3]]
    data[0] = [61, 62]
    data[1] = [[41, 42], [11, 12]]
    data[2] = [[[51, 52], [21, 22]], [[1, 2], [31, 32]]]
    merged = [[1, 2], [11, 12], [21, 22], [31, 32], [41, 42],
              [51, 52], [61, 62]]

This method can be used to merge partitions created by dynamic_partition as illustrated on the following example:

    # Apply function (increments x_i) on elements for which a certain condition
    # apply (x_i != -1 in this example).
    x=tf.constant([0.1, -1., 5.2, 4.3, -1., 7.4])
    condition_mask=tf.not_equal(x,tf.constant(-1.))
    partitioned_data = tf.dynamic_partition(
        x, tf.cast(condition_mask, tf.int32) , 2)
    partitioned_data[1] = partitioned_data[1] + 1.0
    condition_indices = tf.dynamic_partition(
        tf.range(tf.shape(x)[0]), tf.cast(condition_mask, tf.int32) , 2)
    x = tf.dynamic_stitch(condition_indices, partitioned_data)
    # Here x=[1.1, -1., 6.2, 5.3, -1, 8.4], the -1. values remain
    # unchanged.

Traits: SameVariadicOperandSize

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
N ::mlir::Attribute derived attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
indices tensor of 32-bit integer values
data tensor of tf.dtype values

Results:

Result Description
merged tensor of tf.dtype values

tf.Einsum (::mlir::TF::EinsumOp)

Tensor contraction according to Einstein summation convention.

Implements generalized Tensor contraction and reduction. Each input Tensor must have a corresponding input subscript appearing in the comma-separated left-hand side of the equation. The right-hand side of the equation consists of the output subscript. The input subscripts and the output subscript should consist of zero or more named axis labels and at most one ellipsis (...).

The named axis labels may be any single character other than those having special meaning, namely ,.->. The behavior of this Op is undefined if it receives an ill-formatted equation; since the validation is done at graph-building time, we omit format validation checks at runtime.

Operations are applied to the input(s) according to the following rules:

(a) Generalized Diagonals: For input dimensions corresponding to axis labels appearing more than once in the same input subscript, we take the generalized (k-dimensional) diagonal. For example, in the equation iii->i with input shape [3, 3, 3], the generalized diagonal would consist of 3 elements at indices (0, 0, 0), (1, 1, 1) and (2, 2, 2) to create a Tensor of shape [3].

(b) Reduction: Axes corresponding to labels appearing only in one input subscript but not in the output subscript are summed over prior to Tensor contraction. For example, in the equation ab,bc->b, the axis labels a and c are the reduction axis labels.

(c) Batch Dimensions: Axes corresponding to labels appearing in each of the input subscripts and also in the output subscript make up the batch dimensions in Tensor contraction. Unnamed axis labels corresponding to ellipsis (...) also correspond to batch dimensions. For example, for the equation denoting batch matrix multiplication, bij,bjk->bik, the axis label b corresponds to a batch dimension.

(d) Contraction: In case of binary einsum, axes corresponding to labels appearing in two different inputs (and not in the output) are contracted against each other. Considering the batch matrix multiplication equation again (bij,bjk->bik), the contracted axis label is j.

(e) Expand Diagonal: If the output subscripts contain repeated (explicit) axis labels, the opposite operation of (a) is applied. For example, in the equation i->iii, and input shape [3], the output of shape [3, 3, 3] are all zeros, except for the (generalized) diagonal which is populated with values from the input. Note: This operation is not supported by np.einsum or tf.einsum; it is provided to enable computing the symbolic gradient of tf.einsum.

The output subscripts must contain only labels appearing in at least one of the input subscripts. Furthermore, all dimensions mapping to the same axis label must be equal.

Any of the input and output subscripts may contain at most a single ellipsis (...). These ellipsis are mapped against dimensions not corresponding to any named axis label. If two inputs contain ellipsis, then they are broadcasted according to standard NumPy broadcasting rules.

The broadcasted dimensions are placed in the corresponding location of the ellipsis in the output subscript. If the broadcasted dimensions are non-empty and the output subscripts do not contain ellipsis, then an InvalidArgument error is raised.

@compatibility(numpy) Similar to numpy.einsum.

Comparison with numpy.einsum:

  • This Op only supports unary and binary forms of numpy.einsum.
  • This Op does not support implicit form. (i.e. equations without ->).
  • This Op also supports repeated indices in the output subscript, which is not supported by numpy.einsum. @end_compatibility

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
equation ::mlir::StringAttr string attribute
N ::mlir::Attribute derived attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
inputs tensor of tf.dtype values

Results:

Result Description
output tensor of tf.dtype values

tf.EluGrad (::mlir::TF::EluGradOp)

Computes gradients for the exponential linear (Elu) operation.

Traits: TF_SameOperandsAndResultTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
gradients tensor of floating-point values
outputs tensor of floating-point values

Results:

Result Description
backprops tensor of floating-point values

tf.Elu (::mlir::TF::EluOp)

Computes the exponential linear function.

The ELU function is defined as:

  • \( e ^ x - 1 \) if \( x < 0 \)
  • \( x \) if \( x >= 0 \)

Examples:

tf.nn.elu(1.0) tf.nn.elu(0.0) tf.nn.elu(-1000.0)

See Fast and Accurate Deep Network Learning by Exponential Linear Units (ELUs)

Traits: TF_SameOperandsAndResultTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
features tensor of floating-point values

Results:

Result Description
activations tensor of floating-point values

tf.Empty (::mlir::TF::EmptyOp)

Creates a tensor with the given shape.

This operation creates a tensor of shape and dtype.

Attributes:

Attribute MLIR Type Description
init ::mlir::BoolAttr bool attribute
dtype ::mlir::Attribute derived attribute

Operands:

Operand Description
shape tensor of 32-bit integer values

Results:

Result Description
output tensor of tf.dtype values

tf.EmptyTensorList (::mlir::TF::EmptyTensorListOp)

Creates and returns an empty tensor list.

All list elements must be tensors of dtype element_dtype and shape compatible with element_shape.

handle: an empty tensor list. element_dtype: the type of elements in the list. element_shape: a shape compatible with that of elements in the list.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
shape_type ::mlir::Attribute derived attribute
element_dtype ::mlir::Attribute derived attribute

Operands:

Operand Description
element_shape tensor of 32/64-bit signed integer values
max_num_elements tensor of 32-bit integer values

Results:

Result Description
handle tensor of variant values

tf.EnqueueTPUEmbeddingArbitraryTensorBatch (::mlir::TF::EnqueueTPUEmbeddingArbitraryTensorBatchOp)

Eases the porting of code that uses tf.nn.embedding_lookup_sparse().

embedding_indices[i] and aggregation_weights[i] correspond to the ith feature.

The tensors at corresponding positions in the three input lists (sample_indices, embedding_indices and aggregation_weights) must have the same shape, i.e. rank 1 with dim_size() equal to the total number of lookups into the table described by the corresponding feature.

Traits: SameVariadicOperandSize

Interfaces: GetResourceInstanceInterface, TF_TPUEmbeddingWriteEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::TF::ResourceEffects::TPUEmbedding}

Attributes:

Attribute MLIR Type Description
device_ordinal ::mlir::IntegerAttr 64-bit signless integer attribute
combiners ::mlir::ArrayAttr string array attribute
N ::mlir::Attribute derived attribute
T1 ::mlir::Attribute derived attribute
T2 ::mlir::Attribute derived attribute
T3 ::mlir::Attribute derived attribute

Operands:

Operand Description
sample_indices_or_row_lengths tensor of 32/64-bit signed integer values
embedding_indices tensor of 32/64-bit signed integer values
aggregation_weights tensor of 32/64-bit float values
mode_override tensor of string values

tf.EnqueueTPUEmbeddingBatch (::mlir::TF::EnqueueTPUEmbeddingBatchOp)

An op that enqueues a list of input batch tensors to TPUEmbedding.

An op that enqueues a list of input batch tensors to TPUEmbedding.

Interfaces: GetResourceInstanceInterface, TF_TPUEmbeddingWriteEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::TF::ResourceEffects::TPUEmbedding}

Attributes:

Attribute MLIR Type Description
device_ordinal ::mlir::IntegerAttr 64-bit signless integer attribute
combiners ::mlir::ArrayAttr string array attribute
N ::mlir::Attribute derived attribute

Operands:

Operand Description
batch tensor of string values
mode_override tensor of string values

tf.EnqueueTPUEmbeddingIntegerBatch (::mlir::TF::EnqueueTPUEmbeddingIntegerBatchOp)

An op that enqueues a list of input batch tensors to TPUEmbedding.

Interfaces: GetResourceInstanceInterface, TF_TPUEmbeddingWriteEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::TF::ResourceEffects::TPUEmbedding}

Attributes:

Attribute MLIR Type Description
device_ordinal ::mlir::IntegerAttr 64-bit signless integer attribute
N ::mlir::Attribute derived attribute

Operands:

Operand Description
batch tensor of 32-bit integer values
mode_override tensor of string values

tf.EnqueueTPUEmbeddingRaggedTensorBatch (::mlir::TF::EnqueueTPUEmbeddingRaggedTensorBatchOp)

Eases the porting of code that uses tf.nn.embedding_lookup().

sample_splits[i], embedding_indices[i] and aggregation_weights[i] correspond to the ith feature. table_ids[i] indicates which embedding table to look up ith feature.

The tensors at corresponding positions in two of the input lists, embedding_indices and aggregation_weights, must have the same shape, i.e. rank 1 with dim_size() equal to the total number of lookups into the table described by the corresponding feature.

Traits: SameVariadicOperandSize

Interfaces: GetResourceInstanceInterface, TF_TPUEmbeddingWriteEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::TF::ResourceEffects::TPUEmbedding}

Attributes:

Attribute MLIR Type Description
device_ordinal ::mlir::IntegerAttr 64-bit signless integer attribute
combiners ::mlir::ArrayAttr string array attribute
table_ids ::mlir::ArrayAttr 64-bit integer array attribute
max_sequence_lengths ::mlir::ArrayAttr 64-bit integer array attribute
num_features ::mlir::ArrayAttr 64-bit integer array attribute
N ::mlir::Attribute derived attribute
T1 ::mlir::Attribute derived attribute
T2 ::mlir::Attribute derived attribute
T3 ::mlir::Attribute derived attribute

Operands:

Operand Description
sample_splits tensor of 32/64-bit signed integer values
embedding_indices tensor of 32/64-bit signed integer values
aggregation_weights tensor of 32/64-bit float values
mode_override tensor of string values

tf.EnqueueTPUEmbeddingSparseBatch (::mlir::TF::EnqueueTPUEmbeddingSparseBatchOp)

An op that enqueues TPUEmbedding input indices from a SparseTensor.

This Op eases the porting of code that uses embedding_lookup_sparse(), although some Python preprocessing of the SparseTensor arguments to embedding_lookup_sparse() is required to produce the arguments to this Op, since only a single EnqueueTPUEmbeddingSparseBatch Op is allowed per training step.

The tensors at corresponding positions in the three input lists must have the same shape, i.e. rank 1 with dim_size() equal to the total number of lookups into the table described by the corresponding table_id.

Traits: SameVariadicOperandSize

Interfaces: GetResourceInstanceInterface, TF_TPUEmbeddingWriteEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::TF::ResourceEffects::TPUEmbedding}

Attributes:

Attribute MLIR Type Description
device_ordinal ::mlir::IntegerAttr 64-bit signless integer attribute
combiners ::mlir::ArrayAttr string array attribute
N ::mlir::Attribute derived attribute
T1 ::mlir::Attribute derived attribute
T2 ::mlir::Attribute derived attribute
T3 ::mlir::Attribute derived attribute

Operands:

Operand Description
sample_indices tensor of 32/64-bit signed integer values
embedding_indices tensor of 32/64-bit signed integer values
aggregation_weights tensor of 32/64-bit float values
mode_override tensor of string values

tf.EnqueueTPUEmbeddingSparseTensorBatch (::mlir::TF::EnqueueTPUEmbeddingSparseTensorBatchOp)

Eases the porting of code that uses tf.nn.embedding_lookup_sparse().

sample_indices[i], embedding_indices[i] and aggregation_weights[i] correspond to the ith feature. table_ids[i] indicates which embedding table to look up ith feature.

The tensors at corresponding positions in the three input lists (sample_indices, embedding_indices and aggregation_weights) must have the same shape, i.e. rank 1 with dim_size() equal to the total number of lookups into the table described by the corresponding feature.

Traits: SameVariadicOperandSize

Interfaces: GetResourceInstanceInterface, TF_TPUEmbeddingWriteEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::TF::ResourceEffects::TPUEmbedding}

Attributes:

Attribute MLIR Type Description
device_ordinal ::mlir::IntegerAttr 64-bit signless integer attribute
combiners ::mlir::ArrayAttr string array attribute
table_ids ::mlir::ArrayAttr 64-bit integer array attribute
max_sequence_lengths ::mlir::ArrayAttr 64-bit integer array attribute
num_features ::mlir::ArrayAttr 64-bit integer array attribute
N ::mlir::Attribute derived attribute
T1 ::mlir::Attribute derived attribute
T2 ::mlir::Attribute derived attribute
T3 ::mlir::Attribute derived attribute

Operands:

Operand Description
sample_indices tensor of 32/64-bit signed integer values
embedding_indices tensor of 32/64-bit signed integer values
aggregation_weights tensor of 32/64-bit float values
mode_override tensor of string values

tf.EnsureShape (::mlir::TF::EnsureShapeOp)

Ensures that the tensor's shape matches the expected shape.

Raises an error if the input tensor's shape does not match the specified shape. Returns the input tensor otherwise.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
shape ::mlir::Attribute TensorFlow shape attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of tf.dtype values

Results:

Result Description
output tensor of tf.dtype values

tf.Equal (::mlir::TF::EqualOp)

Returns the truth value of (x == y) element-wise.

x = tf.constant([2, 4])
y = tf.constant(2)
tf.math.equal(x, y) ==> array([True, False])

x = tf.constant([2, 4])
y = tf.constant([2, 4])
tf.math.equal(x, y) ==> array([True,  True])

Traits: Commutative

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
incompatible_shape_error ::mlir::BoolAttr bool attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of tf.dtype values
y tensor of tf.dtype values

Results:

Result Description
z tensor of bool values

tf.Erf (::mlir::TF::ErfOp)

Computes the Gauss error function of x element-wise. In statistics, for non-negative values of \(x\), the error function has the following interpretation: for a random variable \(Y\) that is normally distributed with mean 0 and variance \(1/\sqrt{2}\), \(erf(x)\) is the probability that \(Y\) falls in the range \([−x, x]\).

Traits: TF_SameOperandsAndResultTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of floating-point values

Results:

Result Description
y tensor of floating-point values

tf.Erfc (::mlir::TF::ErfcOp)

Computes the complementary error function of x element-wise.

Traits: TF_SameOperandsAndResultTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of floating-point values

Results:

Result Description
y tensor of floating-point values

tf.Erfinv (::mlir::TF::ErfinvOp)

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of floating-point values

Results:

Result Description
y tensor of floating-point values

tf.Exp (::mlir::TF::ExpOp)

Computes exponential of x element-wise. \(y = e^x\).

This function computes the exponential of every element in the input tensor. i.e. exp(x) or e^(x), where x is the input tensor. e denotes Euler's number and is approximately equal to 2.718281. Output is positive for any real input.

  x = tf.constant(2.0)
  tf.math.exp(x) ==> 7.389056

  x = tf.constant([2.0, 8.0])
  tf.math.exp(x) ==> array([7.389056, 2980.958], dtype=float32)

For complex numbers, the exponential value is calculated as follows:

  e^(x+iy) = e^x * e^iy = e^x * (cos y + i sin y)

Let's consider complex number 1+1j as an example. e^1 * (cos 1 + i sin 1) = 2.7182818284590 * (0.54030230586+0.8414709848j)

  x = tf.constant(1 + 1j)
  tf.math.exp(x) ==> 1.4686939399158851+2.2873552871788423j

Traits: SameOperandsAndResultType

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of floating-point or complex values

Results:

Result Description
y tensor of floating-point or complex values

tf.ExpandDims (::mlir::TF::ExpandDimsOp)

Inserts a dimension of 1 into a tensor's shape.

Given a tensor input, this operation inserts a dimension of 1 at the dimension index axis of input's shape. The dimension index axis starts at zero; if you specify a negative number for axis it is counted backward from the end.

This operation is useful if you want to add a batch dimension to a single element. For example, if you have a single image of shape [height, width, channels], you can make it a batch of 1 image with expand_dims(image, 0), which will make the shape [1, height, width, channels].

Other examples:

# 't' is a tensor of shape [2]
shape(expand_dims(t, 0)) ==> [1, 2]
shape(expand_dims(t, 1)) ==> [2, 1]
shape(expand_dims(t, -1)) ==> [2, 1]

# 't2' is a tensor of shape [2, 3, 5]
shape(expand_dims(t2, 0)) ==> [1, 2, 3, 5]
shape(expand_dims(t2, 2)) ==> [2, 3, 1, 5]
shape(expand_dims(t2, 3)) ==> [2, 3, 5, 1]

This operation requires that:

-1-input.dims() <= dim <= input.dims()

This operation is related to squeeze(), which removes dimensions of size 1.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute
Tdim ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of tf.dtype values
dim tensor of 32/64-bit signed integer values

Results:

Result Description
output tensor of tf.dtype values

tf.Expm1 (::mlir::TF::Expm1Op)

Computes exp(x) - 1 element-wise.

i.e. exp(x) - 1 or e^(x) - 1, where x is the input tensor. e denotes Euler's number and is approximately equal to 2.718281.

  x = tf.constant(2.0)
  tf.math.expm1(x) ==> 6.389056

  x = tf.constant([2.0, 8.0])
  tf.math.expm1(x) ==> array([6.389056, 2979.958], dtype=float32)

  x = tf.constant(1 + 1j)
  tf.math.expm1(x) ==> (0.46869393991588515+2.2873552871788423j)

Traits: TF_SameOperandsAndResultTypeResolveRef

Interfaces: InferTypeOpInterface, NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of floating-point or complex values

Results:

Result Description
y tensor of floating-point or complex values

tf.ExtractImagePatches (::mlir::TF::ExtractImagePatchesOp)

Extract patches from images and put them in the "depth" output dimension.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
ksizes ::mlir::ArrayAttr 64-bit integer array attribute with at least 4 elements
strides ::mlir::ArrayAttr 64-bit integer array attribute with at least 4 elements
rates ::mlir::ArrayAttr 64-bit integer array attribute with at least 4 elements
padding ::mlir::StringAttr string attribute whose value is SAME, or VALID
T ::mlir::Attribute derived attribute

Operands:

Operand Description
images tensor of bfloat16 or bool or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

Results:

Result Description
patches tensor of bfloat16 or bool or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

tf.FFT2D (::mlir::TF::FFT2DOp)

2D fast Fourier transform.

Computes the 2-dimensional discrete Fourier transform over the inner-most 2 dimensions of input.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
Tcomplex ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of 128-bit complex or 64-bit complex values

Results:

Result Description
output tensor of 128-bit complex or 64-bit complex values

tf.FFT3D (::mlir::TF::FFT3DOp)

3D fast Fourier transform.

Computes the 3-dimensional discrete Fourier transform over the inner-most 3 dimensions of input.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
Tcomplex ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of 128-bit complex or 64-bit complex values

Results:

Result Description
output tensor of 128-bit complex or 64-bit complex values

tf.FFT (::mlir::TF::FFTOp)

Fast Fourier transform.

Computes the 1-dimensional discrete Fourier transform over the inner-most dimension of input.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
Tcomplex ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of 128-bit complex or 64-bit complex values

Results:

Result Description
output tensor of 128-bit complex or 64-bit complex values

tf.FakeParam (::mlir::TF::FakeParamOp)

This op is used as a placeholder in If branch functions. It doesn't provide a valid output when run, so must either be removed (e.g. replaced with a function input) or guaranteed not to be used (e.g. if mirroring an intermediate output needed for the gradient computation of the other branch).

Traits: TF_NoConstantFold

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
shape ::mlir::Attribute TensorFlow shape attribute
dtype ::mlir::Attribute derived attribute

Results:

Result Description
output tensor of tf.dtype values

tf.FakeQuantWithMinMaxArgsGradient (::mlir::TF::FakeQuantWithMinMaxArgsGradientOp)

Compute gradients for a FakeQuantWithMinMaxArgs operation.

Traits: TF_SameOperandsAndResultTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
min ::mlir::FloatAttr 32-bit float attribute
max ::mlir::FloatAttr 32-bit float attribute
num_bits ::mlir::IntegerAttr 64-bit signless integer attribute
narrow_range ::mlir::BoolAttr bool attribute

Operands:

Operand Description
gradients tensor of 32-bit float values
inputs tensor of 32-bit float values

Results:

Result Description
backprops tensor of 32-bit float values

tf.FakeQuantWithMinMaxArgs (::mlir::TF::FakeQuantWithMinMaxArgsOp)

Fake-quantize the 'inputs' tensor, type float to 'outputs' tensor of same type.

Attributes

  • [min; max] define the clamping range for the inputs data.
  • inputs values are quantized into the quantization range ( [0; 2^num_bits - 1] when narrow_range is false and [1; 2^num_bits - 1] when it is true) and then de-quantized and output as floats in [min; max] interval.
  • num_bits is the bitwidth of the quantization; between 2 and 16, inclusive.

Before quantization, min and max values are adjusted with the following logic. It is suggested to have min <= 0 <= max. If 0 is not in the range of values, the behavior can be unexpected:

  • If 0 < min < max: min_adj = 0 and max_adj = max - min.
  • If min < max < 0: min_adj = min - max and max_adj = 0.
  • If min <= 0 <= max: scale = (max - min) / (2^num_bits - 1), min_adj = scale * round(min / scale) and max_adj = max + min_adj - min.

Quantization is called fake since the output is still in floating point.

Traits: TF_SameOperandsAndResultTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
min ::mlir::FloatAttr 32-bit float attribute
max ::mlir::FloatAttr 32-bit float attribute
num_bits ::mlir::IntegerAttr 64-bit signless integer attribute
narrow_range ::mlir::BoolAttr bool attribute

Operands:

Operand Description
inputs tensor of 32-bit float values

Results:

Result Description
outputs tensor of 32-bit float values

tf.FakeQuantWithMinMaxVarsGradient (::mlir::TF::FakeQuantWithMinMaxVarsGradientOp)

Compute gradients for a FakeQuantWithMinMaxVars operation.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
num_bits ::mlir::IntegerAttr 64-bit signless integer attribute
narrow_range ::mlir::BoolAttr bool attribute

Operands:

Operand Description
gradients tensor of 32-bit float values
inputs tensor of 32-bit float values
min tensor of 32-bit float values
max tensor of 32-bit float values

Results:

Result Description
backprops_wrt_input tensor of 32-bit float values
backprop_wrt_min tensor of 32-bit float values
backprop_wrt_max tensor of 32-bit float values

tf.FakeQuantWithMinMaxVars (::mlir::TF::FakeQuantWithMinMaxVarsOp)

Fake-quantize the 'inputs' tensor of type float via global float scalars

Fake-quantize the inputs tensor of type float via global float scalars min and max to outputs tensor of same shape as inputs.

Attributes

  • [min; max] define the clamping range for the inputs data.
  • inputs values are quantized into the quantization range ( [0; 2^num_bits - 1] when narrow_range is false and [1; 2^num_bits - 1] when it is true) and then de-quantized and output as floats in [min; max] interval.
  • num_bits is the bitwidth of the quantization; between 2 and 16, inclusive.

Before quantization, min and max values are adjusted with the following logic. It is suggested to have min <= 0 <= max. If 0 is not in the range of values, the behavior can be unexpected:

  • If 0 < min < max: min_adj = 0 and max_adj = max - min.
  • If min < max < 0: min_adj = min - max and max_adj = 0.
  • If min <= 0 <= max: scale = (max - min) / (2^num_bits - 1), min_adj = scale * round(min / scale) and max_adj = max + min_adj - min.

This operation has a gradient and thus allows for training min and max values.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
num_bits ::mlir::IntegerAttr 64-bit signless integer attribute
narrow_range ::mlir::BoolAttr bool attribute

Operands:

Operand Description
inputs tensor of 32-bit float values
min tensor of 32-bit float values
max tensor of 32-bit float values

Results:

Result Description
outputs tensor of 32-bit float values

tf.FakeQuantWithMinMaxVarsPerChannelGradient (::mlir::TF::FakeQuantWithMinMaxVarsPerChannelGradientOp)

Compute gradients for a FakeQuantWithMinMaxVarsPerChannel operation.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
num_bits ::mlir::IntegerAttr 64-bit signless integer attribute
narrow_range ::mlir::BoolAttr bool attribute

Operands:

Operand Description
gradients tensor of 32-bit float values
inputs tensor of 32-bit float values
min tensor of 32-bit float values
max tensor of 32-bit float values

Results:

Result Description
backprops_wrt_input tensor of 32-bit float values
backprop_wrt_min tensor of 32-bit float values
backprop_wrt_max tensor of 32-bit float values

tf.FakeQuantWithMinMaxVarsPerChannel (::mlir::TF::FakeQuantWithMinMaxVarsPerChannelOp)

Fake-quantize the 'inputs' tensor of type float via per-channel floats

Fake-quantize the inputs tensor of type float per-channel and one of the shapes: [d], [b, d] [b, h, w, d] via per-channel floats min and max of shape [d] to outputs tensor of same shape as inputs.

Attributes

  • [min; max] define the clamping range for the inputs data.
  • inputs values are quantized into the quantization range ( [0; 2^num_bits - 1] when narrow_range is false and [1; 2^num_bits - 1] when it is true) and then de-quantized and output as floats in [min; max] interval.
  • num_bits is the bitwidth of the quantization; between 2 and 16, inclusive.

Before quantization, min and max values are adjusted with the following logic. It is suggested to have min <= 0 <= max. If 0 is not in the range of values, the behavior can be unexpected:

  • If 0 < min < max: min_adj = 0 and max_adj = max - min.
  • If min < max < 0: min_adj = min - max and max_adj = 0.
  • If min <= 0 <= max: scale = (max - min) / (2^num_bits - 1), min_adj = scale * round(min / scale) and max_adj = max + min_adj - min.

This operation has a gradient and thus allows for training min and max values.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
num_bits ::mlir::IntegerAttr 64-bit signless integer attribute
narrow_range ::mlir::BoolAttr bool attribute

Operands:

Operand Description
inputs tensor of 32-bit float values
min tensor of 32-bit float values
max tensor of 32-bit float values

Results:

Result Description
outputs tensor of 32-bit float values

tf.Fill (::mlir::TF::FillOp)

Creates a tensor filled with a scalar value.

This operation creates a tensor of shape dims and fills it with value.

For example:

# Output tensor has shape [2, 3].
fill([2, 3], 9) ==> [[9, 9, 9]
                     [9, 9, 9]]

tf.fill differs from tf.constant in a few ways:

  • tf.fill only supports scalar contents, whereas tf.constant supports Tensor values.
  • tf.fill creates an Op in the computation graph that constructs the actual Tensor value at runtime. This is in contrast to tf.constant which embeds the entire Tensor into the graph with a Const node.
  • Because tf.fill evaluates at graph runtime, it supports dynamic shapes based on other runtime Tensors, unlike tf.constant.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute
index_type ::mlir::Attribute derived attribute

Operands:

Operand Description
dims tensor of 32/64-bit signed integer values
value tensor of tf.dtype values

Results:

Result Description
output tensor of tf.dtype values

tf.FinalizeDataset (::mlir::TF::FinalizeDatasetOp)

Creates a dataset by applying tf.data.Options to input_dataset.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
has_captured_ref ::mlir::BoolAttr bool attribute
output_types ::mlir::ArrayAttr type array attribute with at least 1 elements
output_shapes ::mlir::ArrayAttr tensorflow shape attribute array with at least 1 elements

Operands:

Operand Description
input_dataset tensor of variant values

Results:

Result Description
handle tensor of variant values

tf.FlatMapDataset (::mlir::TF::FlatMapDatasetOp)

Creates a dataset that applies f to the outputs of input_dataset.

Unlike MapDataset, the f in FlatMapDataset is expected to return a Dataset variant, and FlatMapDataset will flatten successive results into a single Dataset.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
f ::mlir::SymbolRefAttr symbol reference attribute
output_types ::mlir::ArrayAttr type array attribute with at least 1 elements
output_shapes ::mlir::ArrayAttr tensorflow shape attribute array with at least 1 elements
metadata ::mlir::StringAttr string attribute
Targuments ::mlir::Attribute derived attribute

Operands:

Operand Description
input_dataset tensor of variant values
other_arguments tensor of tf.dtype values

Results:

Result Description
handle tensor of variant values

tf.FloorDiv (::mlir::TF::FloorDivOp)

Returns x // y element-wise.

Traits: ResultsBroadcastableShape

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values
y tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

Results:

Result Description
z tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

tf.FloorMod (::mlir::TF::FloorModOp)

Returns element-wise remainder of division. When x < 0 xor y < 0 is

true, this follows Python semantics in that the result here is consistent with a flooring divide. E.g. floor(x / y) * y + mod(x, y) = x.

Traits: ResultsBroadcastableShape, TF_SameOperandsAndResultElementTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of integer or floating-point values
y tensor of integer or floating-point values

Results:

Result Description
z tensor of integer or floating-point values

tf.Floor (::mlir::TF::FloorOp)

Returns element-wise largest integer not greater than x.

Traits: Idempotent, SameOperandsAndResultType

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of floating-point values

Results:

Result Description
y tensor of floating-point values

tf.FlushSummaryWriter (::mlir::TF::FlushSummaryWriterOp)

Flushes the writer's unwritten events.

writer: A handle to the summary writer resource.

Operands:

Operand Description
writer tensor of resource values

tf.FusedBatchNormGrad (::mlir::TF::FusedBatchNormGradOp)

Gradient for batch normalization.

Note that the size of 4D Tensors are defined by either "NHWC" or "NCHW". The size of 1D Tensors matches the dimension C of the 4D Tensors.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
epsilon ::mlir::FloatAttr 32-bit float attribute
data_format ::mlir::StringAttr 'NHWC' or 'NCHW' convnet data format
is_training ::mlir::BoolAttr bool attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
y_backprop tensor of 32-bit float values
x tensor of 32-bit float values
scale tensor of 32-bit float values
reserve_space_1 tensor of 32-bit float values
reserve_space_2 tensor of 32-bit float values

Results:

Result Description
x_backprop tensor of 32-bit float values
scale_backprop tensor of 32-bit float values
offset_backprop tensor of 32-bit float values
reserve_space_3 tensor of 32-bit float values
reserve_space_4 tensor of 32-bit float values

tf.FusedBatchNormGradV2 (::mlir::TF::FusedBatchNormGradV2Op)

Gradient for batch normalization.

Note that the size of 4D Tensors are defined by either "NHWC" or "NCHW". The size of 1D Tensors matches the dimension C of the 4D Tensors.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
epsilon ::mlir::FloatAttr 32-bit float attribute
data_format ::mlir::StringAttr 'NHWC' or 'NCHW' convnet data format
is_training ::mlir::BoolAttr bool attribute
T ::mlir::Attribute derived attribute
U ::mlir::Attribute derived attribute

Operands:

Operand Description
y_backprop tensor of bfloat16 or 16-bit float or 32-bit float values
x tensor of bfloat16 or 16-bit float or 32-bit float values
scale tensor of 32-bit float values
reserve_space_1 tensor of 32-bit float values
reserve_space_2 tensor of 32-bit float values

Results:

Result Description
x_backprop tensor of bfloat16 or 16-bit float or 32-bit float values
scale_backprop tensor of 32-bit float values
offset_backprop tensor of 32-bit float values
reserve_space_3 tensor of 32-bit float values
reserve_space_4 tensor of 32-bit float values

tf.FusedBatchNormGradV3 (::mlir::TF::FusedBatchNormGradV3Op)

Gradient for batch normalization.

Note that the size of 4D Tensors are defined by either "NHWC" or "NCHW". The size of 1D Tensors matches the dimension C of the 4D Tensors.

Interfaces: NoSideEffect (MemoryEffectOpInterface), TF_LayoutSensitiveInterface

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
epsilon ::mlir::FloatAttr 32-bit float attribute
data_format ::mlir::StringAttr string attribute whose value is NHWC, or NCHW, or NDHWC, or NCDHW
is_training ::mlir::BoolAttr bool attribute
T ::mlir::Attribute derived attribute
U ::mlir::Attribute derived attribute

Operands:

Operand Description
y_backprop tensor of bfloat16 or 16-bit float or 32-bit float values
x tensor of bfloat16 or 16-bit float or 32-bit float values
scale tensor of 32-bit float values
reserve_space_1 tensor of 32-bit float values
reserve_space_2 tensor of 32-bit float values
reserve_space_3 tensor of 32-bit float values

Results:

Result Description
x_backprop tensor of bfloat16 or 16-bit float or 32-bit float values
scale_backprop tensor of 32-bit float values
offset_backprop tensor of 32-bit float values
reserve_space_4 tensor of 32-bit float values
reserve_space_5 tensor of 32-bit float values

tf.FusedBatchNorm (::mlir::TF::FusedBatchNormOp)

Batch normalization.

Note that the size of 4D Tensors are defined by either "NHWC" or "NCHW". The size of 1D Tensors matches the dimension C of the 4D Tensors.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
epsilon ::mlir::FloatAttr 32-bit float attribute
exponential_avg_factor ::mlir::FloatAttr 32-bit float attribute
data_format ::mlir::StringAttr 'NHWC' or 'NCHW' convnet data format
is_training ::mlir::BoolAttr bool attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of 32-bit float values
scale tensor of 32-bit float values
offset tensor of 32-bit float values
mean tensor of 32-bit float values
variance tensor of 32-bit float values

Results:

Result Description
y tensor of 32-bit float values
batch_mean tensor of 32-bit float values
batch_variance tensor of 32-bit float values
reserve_space_1 tensor of 32-bit float values
reserve_space_2 tensor of 32-bit float values

tf.FusedBatchNormV2 (::mlir::TF::FusedBatchNormV2Op)

Batch normalization.

Note that the size of 4D Tensors are defined by either "NHWC" or "NCHW". The size of 1D Tensors matches the dimension C of the 4D Tensors.

Interfaces: NoSideEffect (MemoryEffectOpInterface), TF_FoldOperandsTransposeInterface, TF_LayoutSensitiveInterface

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
epsilon ::mlir::FloatAttr 32-bit float attribute
exponential_avg_factor ::mlir::FloatAttr 32-bit float attribute
data_format ::mlir::StringAttr 'NHWC' or 'NCHW' convnet data format
is_training ::mlir::BoolAttr bool attribute
T ::mlir::Attribute derived attribute
U ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of bfloat16 or 16-bit float or 32-bit float values
scale tensor of 32-bit float values
offset tensor of 32-bit float values
mean tensor of 32-bit float values
variance tensor of 32-bit float values

Results:

Result Description
y tensor of bfloat16 or 16-bit float or 32-bit float values
batch_mean tensor of 32-bit float values
batch_variance tensor of 32-bit float values
reserve_space_1 tensor of 32-bit float values
reserve_space_2 tensor of 32-bit float values

tf.FusedBatchNormV3 (::mlir::TF::FusedBatchNormV3Op)

Batch normalization.

Note that the size of 4D Tensors are defined by either "NHWC" or "NCHW". The size of 1D Tensors matches the dimension C of the 4D Tensors.

Interfaces: NoSideEffect (MemoryEffectOpInterface), TF_FoldOperandsTransposeInterface, TF_LayoutSensitiveInterface

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
epsilon ::mlir::FloatAttr 32-bit float attribute
exponential_avg_factor ::mlir::FloatAttr 32-bit float attribute
data_format ::mlir::StringAttr string attribute whose value is NHWC, or NCHW, or NDHWC, or NCDHW
is_training ::mlir::BoolAttr bool attribute
T ::mlir::Attribute derived attribute
U ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of bfloat16 or 16-bit float or 32-bit float values
scale tensor of 32-bit float values
offset tensor of 32-bit float values
mean tensor of 32-bit float values
variance tensor of 32-bit float values

Results:

Result Description
y tensor of bfloat16 or 16-bit float or 32-bit float values
batch_mean tensor of 32-bit float values
batch_variance tensor of 32-bit float values
reserve_space_1 tensor of 32-bit float values
reserve_space_2 tensor of 32-bit float values
reserve_space_3 tensor of 32-bit float values

tf.GatherNd (::mlir::TF::GatherNdOp)

Gather slices from params into a Tensor with shape specified by indices.

indices is a K-dimensional integer tensor, best thought of as a (K-1)-dimensional tensor of indices into params, where each element defines a slice of params:

output[\\(i_0, ..., i_{K-2}\\)] = params[indices[\\(i_0, ..., i_{K-2}\\)]]

Whereas in tf.gather indices defines slices into the axis dimension of params, in tf.gather_nd, indices defines slices into the first N dimensions of params, where N = indices.shape[-1].

The last dimension of indices can be at most the rank of params:

indices.shape[-1] <= params.rank

The last dimension of indices corresponds to elements (if indices.shape[-1] == params.rank) or slices (if indices.shape[-1] < params.rank) along dimension indices.shape[-1] of params. The output tensor has shape

indices.shape[:-1] + params.shape[indices.shape[-1]:]

Note that on CPU, if an out of bound index is found, an error is returned. On GPU, if an out of bound index is found, a 0 is stored in the corresponding output value.

Some examples below.

Simple indexing into a matrix:

    indices = [[0, 0], [1, 1]]
    params = [['a', 'b'], ['c', 'd']]
    output = ['a', 'd']

Slice indexing into a matrix:

    indices = [[1], [0]]
    params = [['a', 'b'], ['c', 'd']]
    output = [['c', 'd'], ['a', 'b']]

Indexing into a 3-tensor:

    indices = [[1]]
    params = [[['a0', 'b0'], ['c0', 'd0']],
              [['a1', 'b1'], ['c1', 'd1']]]
    output = [[['a1', 'b1'], ['c1', 'd1']]]


    indices = [[0, 1], [1, 0]]
    params = [[['a0', 'b0'], ['c0', 'd0']],
              [['a1', 'b1'], ['c1', 'd1']]]
    output = [['c0', 'd0'], ['a1', 'b1']]


    indices = [[0, 0, 1], [1, 0, 1]]
    params = [[['a0', 'b0'], ['c0', 'd0']],
              [['a1', 'b1'], ['c1', 'd1']]]
    output = ['b0', 'b1']

Batched indexing into a matrix:

    indices = [[[0, 0]], [[0, 1]]]
    params = [['a', 'b'], ['c', 'd']]
    output = [['a'], ['b']]

Batched slice indexing into a matrix:

    indices = [[[1]], [[0]]]
    params = [['a', 'b'], ['c', 'd']]
    output = [[['c', 'd']], [['a', 'b']]]

Batched indexing into a 3-tensor:

    indices = [[[1]], [[0]]]
    params = [[['a0', 'b0'], ['c0', 'd0']],
              [['a1', 'b1'], ['c1', 'd1']]]
    output = [[[['a1', 'b1'], ['c1', 'd1']]],
              [[['a0', 'b0'], ['c0', 'd0']]]]

    indices = [[[0, 1], [1, 0]], [[0, 0], [1, 1]]]
    params = [[['a0', 'b0'], ['c0', 'd0']],
              [['a1', 'b1'], ['c1', 'd1']]]
    output = [[['c0', 'd0'], ['a1', 'b1']],
              [['a0', 'b0'], ['c1', 'd1']]]


    indices = [[[0, 0, 1], [1, 0, 1]], [[0, 1, 1], [1, 1, 0]]]
    params = [[['a0', 'b0'], ['c0', 'd0']],
              [['a1', 'b1'], ['c1', 'd1']]]
    output = [['b0', 'b1'], ['d0', 'c1']]

See also tf.gather and tf.batch_gather.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
Tindices ::mlir::Attribute derived attribute
Tparams ::mlir::Attribute derived attribute

Operands:

Operand Description
params tensor of tf.dtype values
indices tensor of 32/64-bit signed integer values

Results:

Result Description
output tensor of tf.dtype values

tf.Gather (::mlir::TF::GatherOp)

Gather slices from params according to indices.

indices must be an integer tensor of any dimension (usually 0-D or 1-D). Produces an output tensor with shape indices.shape + params.shape[1:] where:

    # Scalar indices
    output[:, ..., :] = params[indices, :, ... :]

    # Vector indices
    output[i, :, ..., :] = params[indices[i], :, ... :]

    # Higher rank indices
    output[i, ..., j, :, ... :] = params[indices[i, ..., j], :, ..., :]

If indices is a permutation and len(indices) == params.shape[0] then this operation will permute params accordingly.

validate_indices: DEPRECATED. If this operation is assigned to CPU, values in indices are always validated to be within range. If assigned to GPU, out-of-bound indices result in safe but unspecified behavior, which may include raising an error.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
validate_indices ::mlir::BoolAttr bool attribute
Tindices ::mlir::Attribute derived attribute
Tparams ::mlir::Attribute derived attribute

Operands:

Operand Description
params tensor of tf.dtype values
indices tensor of 32/64-bit signed integer values

Results:

Result Description
output tensor of tf.dtype values

tf.GatherV2 (::mlir::TF::GatherV2Op)

Gather slices from params axis axis according to indices.

indices must be an integer tensor of any dimension (usually 0-D or 1-D). Produces an output tensor with shape params.shape[:axis] + indices.shape[batch_dims:] + params.shape[axis + 1:] where:

    # Scalar indices (output is rank(params) - 1).
    output[a_0, ..., a_n, b_0, ..., b_n] =
      params[a_0, ..., a_n, indices, b_0, ..., b_n]

    # Vector indices (output is rank(params)).
    output[a_0, ..., a_n, i, b_0, ..., b_n] =
      params[a_0, ..., a_n, indices[i], b_0, ..., b_n]

    # Higher rank indices (output is rank(params) + rank(indices) - 1).
    output[a_0, ..., a_n, i, ..., j, b_0, ... b_n] =
      params[a_0, ..., a_n, indices[i, ..., j], b_0, ..., b_n]

Note that on CPU, if an out of bound index is found, an error is returned. On GPU, if an out of bound index is found, a 0 is stored in the corresponding output value.

See also tf.batch_gather and tf.gather_nd.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
batch_dims ::mlir::IntegerAttr 64-bit signless integer attribute
Taxis ::mlir::Attribute derived attribute
Tindices ::mlir::Attribute derived attribute
Tparams ::mlir::Attribute derived attribute

Operands:

Operand Description
params tensor of tf.dtype values
indices tensor of 32/64-bit signed integer values
axis tensor of 32/64-bit signed integer values

Results:

Result Description
output tensor of tf.dtype values

tf.GeneratorDataset (::mlir::TF::GeneratorDatasetOp)

Creates a dataset that invokes a function to generate elements.

Traits: AttrSizedOperandSegments

Interfaces: TF_GeneratorOpSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{MemoryEffects::Write on ::mlir::TF::ResourceEffects::GeneratorOp}

Attributes:

Attribute MLIR Type Description
init_func ::mlir::SymbolRefAttr symbol reference attribute
next_func ::mlir::SymbolRefAttr symbol reference attribute
finalize_func ::mlir::SymbolRefAttr symbol reference attribute
output_types ::mlir::ArrayAttr type array attribute with at least 1 elements
output_shapes ::mlir::ArrayAttr tensorflow shape attribute array with at least 1 elements
metadata ::mlir::StringAttr string attribute
Tfinalize_func_args ::mlir::Attribute derived attribute
Tinit_func_args ::mlir::Attribute derived attribute
Tnext_func_args ::mlir::Attribute derived attribute

Operands:

Operand Description
init_func_other_args tensor of tf.dtype values
next_func_other_args tensor of tf.dtype values
finalize_func_other_args tensor of tf.dtype values

Results:

Result Description
handle tensor of variant values

tf.GreaterEqual (::mlir::TF::GreaterEqualOp)

Returns the truth value of (x >= y) element-wise.

Example:

x = tf.constant([5, 4, 6, 7])
y = tf.constant([5, 2, 5, 10])
tf.math.greater_equal(x, y) ==> [True, True, True, False]

x = tf.constant([5, 4, 6, 7])
y = tf.constant([5])
tf.math.greater_equal(x, y) ==> [True, False, True, True]

Traits: ResultsBroadcastableShape

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of integer or floating-point values
y tensor of integer or floating-point values

Results:

Result Description
z tensor of bool values

tf.Greater (::mlir::TF::GreaterOp)

Returns the truth value of (x > y) element-wise.

Example:

x = tf.constant([5, 4, 6])
y = tf.constant([5, 2, 5])
tf.math.greater(x, y) ==> [False, True, True]

x = tf.constant([5, 4, 6])
y = tf.constant([5])
tf.math.greater(x, y) ==> [False, False, True]

Traits: ResultsBroadcastableShape

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of integer or floating-point values
y tensor of integer or floating-point values

Results:

Result Description
z tensor of bool values

tf.HSVToRGB (::mlir::TF::HSVToRGBOp)

Convert one or more images from HSV to RGB.

Outputs a tensor of the same shape as the images tensor, containing the RGB value of the pixels. The output is only well defined if the value in images are in [0,1].

See rgb_to_hsv for a description of the HSV encoding.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
images tensor of floating-point values

Results:

Result Description
output tensor of floating-point values

tf.HashTable (::mlir::TF::HashTableOp)

Creates a non-initialized hash table.

This op creates a hash table, specifying the type of its keys and values. Before using the table you will have to initialize it. After initialization the table will be immutable.

Attributes:

Attribute MLIR Type Description
container ::mlir::StringAttr string attribute
shared_name ::mlir::StringAttr string attribute
use_node_name_sharing ::mlir::BoolAttr bool attribute
key_dtype ::mlir::TypeAttr any type attribute
value_dtype ::mlir::TypeAttr any type attribute

Results:

Result Description
table_handle tensor of string values

tf.HashTableV2 (::mlir::TF::HashTableV2Op)

Creates a non-initialized hash table.

This op creates a hash table, specifying the type of its keys and values. Before using the table you will have to initialize it. After initialization the table will be immutable.

Attributes:

Attribute MLIR Type Description
container ::mlir::StringAttr string attribute
shared_name ::mlir::StringAttr string attribute
use_node_name_sharing ::mlir::BoolAttr bool attribute
key_dtype ::mlir::TypeAttr any type attribute
value_dtype ::mlir::TypeAttr any type attribute

Results:

Result Description
table_handle tensor of resource values

tf.IFFT2D (::mlir::TF::IFFT2DOp)

Inverse 2D fast Fourier transform.

Computes the inverse 2-dimensional discrete Fourier transform over the inner-most 2 dimensions of input.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
Tcomplex ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of 128-bit complex or 64-bit complex values

Results:

Result Description
output tensor of 128-bit complex or 64-bit complex values

tf.IFFT3D (::mlir::TF::IFFT3DOp)

Inverse 3D fast Fourier transform.

Computes the inverse 3-dimensional discrete Fourier transform over the inner-most 3 dimensions of input.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
Tcomplex ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of 128-bit complex or 64-bit complex values

Results:

Result Description
output tensor of 128-bit complex or 64-bit complex values

tf.IFFT (::mlir::TF::IFFTOp)

Inverse fast Fourier transform.

Computes the inverse 1-dimensional discrete Fourier transform over the inner-most dimension of input.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
Tcomplex ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of 128-bit complex or 64-bit complex values

Results:

Result Description
output tensor of 128-bit complex or 64-bit complex values

tf.IRFFT2D (::mlir::TF::IRFFT2DOp)

Inverse 2D real-valued fast Fourier transform.

Computes the inverse 2-dimensional discrete Fourier transform of a real-valued signal over the inner-most 2 dimensions of input.

The inner-most 2 dimensions of input are assumed to be the result of RFFT2D: The inner-most dimension contains the fft_length / 2 + 1 unique components of the DFT of a real-valued signal. If fft_length is not provided, it is computed from the size of the inner-most 2 dimensions of input. If the FFT length used to compute input is odd, it should be provided since it cannot be inferred properly.

Along each axis IRFFT2D is computed on, if fft_length (or fft_length / 2 + 1 for the inner-most dimension) is smaller than the corresponding dimension of input, the dimension is cropped. If it is larger, the dimension is padded with zeros.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
Tcomplex ::mlir::Attribute derived attribute
Treal ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of 128-bit complex or 64-bit complex values
fft_length tensor of 32-bit integer values

Results:

Result Description
output tensor of 32/64-bit float values

tf.IRFFT3D (::mlir::TF::IRFFT3DOp)

Inverse 3D real-valued fast Fourier transform.

Computes the inverse 3-dimensional discrete Fourier transform of a real-valued signal over the inner-most 3 dimensions of input.

The inner-most 3 dimensions of input are assumed to be the result of RFFT3D: The inner-most dimension contains the fft_length / 2 + 1 unique components of the DFT of a real-valued signal. If fft_length is not provided, it is computed from the size of the inner-most 3 dimensions of input. If the FFT length used to compute input is odd, it should be provided since it cannot be inferred properly.

Along each axis IRFFT3D is computed on, if fft_length (or fft_length / 2 + 1 for the inner-most dimension) is smaller than the corresponding dimension of input, the dimension is cropped. If it is larger, the dimension is padded with zeros.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
Tcomplex ::mlir::Attribute derived attribute
Treal ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of 128-bit complex or 64-bit complex values
fft_length tensor of 32-bit integer values

Results:

Result Description
output tensor of 32/64-bit float values

tf.IRFFT (::mlir::TF::IRFFTOp)

Inverse real-valued fast Fourier transform.

Computes the inverse 1-dimensional discrete Fourier transform of a real-valued signal over the inner-most dimension of input.

The inner-most dimension of input is assumed to be the result of RFFT: the fft_length / 2 + 1 unique components of the DFT of a real-valued signal. If fft_length is not provided, it is computed from the size of the inner-most dimension of input (fft_length = 2 * (inner - 1)). If the FFT length used to compute input is odd, it should be provided since it cannot be inferred properly.

Along the axis IRFFT is computed on, if fft_length / 2 + 1 is smaller than the corresponding dimension of input, the dimension is cropped. If it is larger, the dimension is padded with zeros.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
Tcomplex ::mlir::Attribute derived attribute
Treal ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of 128-bit complex or 64-bit complex values
fft_length tensor of 32-bit integer values

Results:

Result Description
output tensor of 32/64-bit float values

tf.IdentityN (::mlir::TF::IdentityNOp)

Returns a list of tensors with the same shapes and contents as the input

tensors.

This op can be used to override the gradient for complicated functions. For example, suppose y = f(x) and we wish to apply a custom function g for backprop such that dx = g(dy). In Python,

with tf.get_default_graph().gradient_override_map(
    {'IdentityN': 'OverrideGradientWithG'}):
  y, _ = identity_n([f(x), x])

@tf.RegisterGradient('OverrideGradientWithG')
def ApplyG(op, dy, _):
  return [None, g(dy)]  # Do not backprop to f(x).

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of tf.dtype values

Results:

Result Description
output tensor of tf.dtype values

tf.Identity (::mlir::TF::IdentityOp)

Return a tensor with the same shape and contents as the input tensor or value.

Traits: TF_NoConstantFold, TF_OperandsSameAsResultsTypeOrRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of tf.dtype values

Results:

Result Description
output tensor of tf.dtype values

tf.If (::mlir::TF::IfOp)

output = cond ? then_branch(input) : else_branch(input)

output = cond ? then_branch(input) : else_branch(input)

cond: A Tensor. If the tensor is a scalar of non-boolean type, the scalar is converted to a boolean according to the following rule: if the scalar is a numerical value, non-zero means True and zero means False; if the scalar is a string, non-empty means True and empty means False. If the tensor is not a scalar, being empty means False and being non-empty means True. input: A list of input tensors. then_branch: A function that takes 'inputs' and returns a list of tensors, whose types are the same as what else_branch returns. else_branch: A function that takes 'inputs' and returns a list of tensors. whose types are the same as what then_branch returns.

Interfaces: SymbolUserOpInterface

Attributes:

Attribute MLIR Type Description
then_branch ::mlir::FlatSymbolRefAttr flat symbol reference attribute
else_branch ::mlir::FlatSymbolRefAttr flat symbol reference attribute
is_stateless ::mlir::BoolAttr bool attribute
Tcond ::mlir::Attribute derived attribute
Tin ::mlir::Attribute derived attribute
Tout ::mlir::Attribute derived attribute
output_shapes ::mlir::Attribute derived attribute

Operands:

Operand Description
cond tensor of tf.dtype values
input tensor of tf.dtype values

Results:

Result Description
output tensor of tf.dtype values

tf.IfRegion (::mlir::TF::IfRegionOp)

output = cond ? then_branch output : else_branch output

"output = cond ? then_branch output : else_branch output"

cond: A Tensor. If the tensor is a scalar of non-boolean type, the scalar is converted to a boolean according to the following rule: if the scalar is a numerical value, non-zero means True and zero means False; if the scalar is a string, non-empty means True and empty means False. If the tensor is not a scalar, being empty means False and being non-empty means True. then_branch: A region that computes the outputs of the op if cond = true. It returns a list of tensors using tf.yield (as the terminator). The types of these returned tensors is same as that of the else_branch else_branch: A region that computes the outputs of the op if cond = false. It returns a list of tensors using tf.yield (as the terminator). The types of these returned tensors is same as that of the then_branch

Traits: NoRegionArguments, SingleBlockImplicitTerminator

Attributes:

Attribute MLIR Type Description
is_stateless ::mlir::BoolAttr bool attribute
_then_func_name ::mlir::StringAttr string attribute
_else_func_name ::mlir::StringAttr string attribute

Operands:

Operand Description
cond 0D tensor of 1-bit signless integer values

Results:

Result Description
output tensor of tf.dtype values

tf.IgammaGradA (::mlir::TF::IgammaGradAOp)

Computes the gradient of igamma(a, x) wrt a.

Traits: ResultsBroadcastableShape, TF_SameOperandsAndResultElementTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
a tensor of 32/64-bit float values
x tensor of 32/64-bit float values

Results:

Result Description
z tensor of 32/64-bit float values

tf.Igamma (::mlir::TF::IgammaOp)

Compute the lower regularized incomplete Gamma function P(a, x).

The lower regularized incomplete Gamma function is defined as:

\(P(a, x) = gamma(a, x) / Gamma(a) = 1 - Q(a, x)\)

where

\(gamma(a, x) = \\int_{0}^{x} t^{a-1} exp(-t) dt\)

is the lower incomplete Gamma function.

Note, above Q(a, x) (Igammac) is the upper regularized complete Gamma function.

Traits: ResultsBroadcastableShape, TF_SameOperandsAndResultElementTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
a tensor of floating-point values
x tensor of floating-point values

Results:

Result Description
z tensor of floating-point values

tf.Igammac (::mlir::TF::IgammacOp)

Compute the upper regularized incomplete Gamma function Q(a, x).

The upper regularized incomplete Gamma function is defined as:

\(Q(a, x) = Gamma(a, x) / Gamma(a) = 1 - P(a, x)\)

where

\(Gamma(a, x) = \int_{x}^{\infty} t^{a-1} exp(-t) dt\)

is the upper incomplete Gamma function.

Note, above P(a, x) (Igamma) is the lower regularized complete Gamma function.

Traits: ResultsBroadcastableShape, TF_SameOperandsAndResultElementTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
a tensor of floating-point values
x tensor of floating-point values

Results:

Result Description
z tensor of floating-point values

tf.Imag (::mlir::TF::ImagOp)

Returns the imaginary part of a complex number.

Given a tensor input of complex numbers, this operation returns a tensor of type float that is the imaginary part of each element in input. All elements in input must be complex numbers of the form \(a + bj\), where a is the real part and b is the imaginary part returned by this operation.

For example:

# tensor 'input' is [-2.25 + 4.75j, 3.25 + 5.75j]
tf.imag(input) ==> [4.75, 5.75]

Traits: SameOperandsAndResultShape

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute
Tout ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of 128-bit complex or 64-bit complex values

Results:

Result Description
output tensor of 32/64-bit float values

tf.ImportEvent (::mlir::TF::ImportEventOp)

Outputs a tf.Event protocol buffer.

When CreateSummaryDbWriter is being used, this op can be useful for importing data from event logs.

writer: A handle to a summary writer. event: A string containing a binary-encoded tf.Event proto.

Operands:

Operand Description
writer tensor of resource values
event tensor of string values

tf.InTopKV2 (::mlir::TF::InTopKV2Op)

Says whether the targets are in the top K predictions.

This outputs a batch_size bool array, an entry out[i] is true if the prediction for the target class is among the top k predictions among all predictions for example i. Note that the behavior of InTopK differs from the TopK op in its handling of ties; if multiple classes have the same prediction value and straddle the top-k boundary, all of those classes are considered to be in the top k.

More formally, let

\(predictions_i\) be the predictions for all classes for example i, \(targets_i\) be the target class for example i, \(out_i\) be the output for example i,

\[out_i = predictions_{i, targets_i} \in TopKIncludingTies(predictions_i)\]

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
predictions tensor of 32-bit float values
targets tensor of 32/64-bit signed integer values
k tensor of 32/64-bit signed integer values

Results:

Result Description
precision tensor of bool values

tf.InfeedDequeue (::mlir::TF::InfeedDequeueOp)

A placeholder op for a value that will be fed into the computation.

Attributes:

Attribute MLIR Type Description
shape ::mlir::Attribute TensorFlow shape attribute
dtype ::mlir::Attribute derived attribute

Results:

Result Description
output tensor of tf.dtype values

tf.InfeedDequeueTuple (::mlir::TF::InfeedDequeueTupleOp)

Fetches multiple values from infeed as an XLA tuple.

Attributes:

Attribute MLIR Type Description
_XlaSharding ::mlir::StringAttr string attribute
shapes ::mlir::Attribute derived attribute
dtypes ::mlir::Attribute derived attribute

Results:

Result Description
outputs tensor of tf.dtype values

tf.InfeedEnqueueTuple (::mlir::TF::InfeedEnqueueTupleOp)

Feeds multiple Tensor values into the computation as an XLA tuple.

Attributes:

Attribute MLIR Type Description
dtypes ::mlir::ArrayAttr type array attribute with at least 1 elements
shapes ::mlir::ArrayAttr tensorflow shape attribute array
layouts ::mlir::ArrayAttr 64-bit integer array attribute
device_ordinal ::mlir::IntegerAttr 64-bit signless integer attribute

Operands:

Operand Description
inputs tensor of tf.dtype values

tf.InitializeTableFromDataset (::mlir::TF::InitializeTableFromDatasetOp)

Operands:

Operand Description
table_handle tensor of resource values
dataset tensor of variant values

tf.InitializeTableFromTextFile (::mlir::TF::InitializeTableFromTextFileOp)

Initializes a table from a text file.

It inserts one key-value pair into the table for each line of the file. The key and value is extracted from the whole line content, elements from the split line based on delimiter or the line number (starting from zero). Where to extract the key and value from a line is specified by key_index and value_index.

  • A value of -1 means use the line number(starting from zero), expects int64.
  • A value of -2 means use the whole line content, expects string.
  • A value >= 0 means use the index (starting at zero) of the split line based on delimiter.

Attributes:

Attribute MLIR Type Description
key_index ::mlir::IntegerAttr 64-bit signless integer attribute whose minimum value is -2
value_index ::mlir::IntegerAttr 64-bit signless integer attribute whose minimum value is -2
vocab_size ::mlir::IntegerAttr 64-bit signless integer attribute whose minimum value is -1
delimiter ::mlir::StringAttr string attribute
offset ::mlir::IntegerAttr 64-bit signless integer attribute

Operands:

Operand Description
table_handle tensor of string values
filename tensor of string values

tf.InitializeTableFromTextFileV2 (::mlir::TF::InitializeTableFromTextFileV2Op)

Initializes a table from a text file.

It inserts one key-value pair into the table for each line of the file. The key and value is extracted from the whole line content, elements from the split line based on delimiter or the line number (starting from zero). Where to extract the key and value from a line is specified by key_index and value_index.

  • A value of -1 means use the line number(starting from zero), expects int64.
  • A value of -2 means use the whole line content, expects string.
  • A value >= 0 means use the index (starting at zero) of the split line based on delimiter.

Attributes:

Attribute MLIR Type Description
key_index ::mlir::IntegerAttr 64-bit signless integer attribute whose minimum value is -2
value_index ::mlir::IntegerAttr 64-bit signless integer attribute whose minimum value is -2
vocab_size ::mlir::IntegerAttr 64-bit signless integer attribute whose minimum value is -1
delimiter ::mlir::StringAttr string attribute
offset ::mlir::IntegerAttr 64-bit signless integer attribute

Operands:

Operand Description
table_handle tensor of resource values
filename tensor of string values

tf.InitializeTable (::mlir::TF::InitializeTableOp)

Table initializer that takes two tensors for keys and values respectively.

Attributes:

Attribute MLIR Type Description
Tkey ::mlir::Attribute derived attribute
Tval ::mlir::Attribute derived attribute

Operands:

Operand Description
table_handle tensor of string values
keys tensor of tf.dtype values
values tensor of tf.dtype values

tf.InitializeTableV2 (::mlir::TF::InitializeTableV2Op)

Table initializer that takes two tensors for keys and values respectively.

Attributes:

Attribute MLIR Type Description
Tkey ::mlir::Attribute derived attribute
Tval ::mlir::Attribute derived attribute

Operands:

Operand Description
table_handle tensor of resource values
keys tensor of tf.dtype values
values tensor of tf.dtype values

tf.InplaceAdd (::mlir::TF::InplaceAddOp)

Adds v into specified rows of x.

Computes y = x; y[i, :] += v; return y.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of tf.dtype values
i tensor of 32-bit integer values
v tensor of tf.dtype values

Results:

Result Description
y tensor of tf.dtype values

tf.InplaceUpdate (::mlir::TF::InplaceUpdateOp)

Updates specified rows 'i' with values 'v'.

Computes x[i, :] = v; return x.

Originally this function is mutative however for compilation we make this operation create / operate on a copy of x.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of tf.dtype values
i tensor of 32-bit integer values
v tensor of tf.dtype values

Results:

Result Description
y tensor of tf.dtype values

tf.Inv (::mlir::TF::InvOp)

Computes the reciprocal of x element-wise.

I.e., \(y = 1 / x\).

Traits: TF_SameOperandsAndResultTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer values

Results:

Result Description
y tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer values

tf.Invert (::mlir::TF::InvertOp)

Invert (flip) each bit of supported types; for example, type uint8 value 01010101 becomes 10101010.

Flip each bit of supported types. For example, type int8 (decimal 2) binary 00000010 becomes (decimal -3) binary 11111101. This operation is performed on each element of the tensor argument x.

Example:

import tensorflow as tf
from tensorflow.python.ops import bitwise_ops

# flip 2 (00000010) to -3 (11111101)
tf.assert_equal(-3, bitwise_ops.invert(2))

dtype_list = [dtypes.int8, dtypes.int16, dtypes.int32, dtypes.int64,
              dtypes.uint8, dtypes.uint16, dtypes.uint32, dtypes.uint64]

inputs = [0, 5, 3, 14]
for dtype in dtype_list:
  # Because of issues with negative numbers, let's test this indirectly.
  # 1. invert(a) and a = 0
  # 2. invert(a) or a = invert(0)
  input_tensor = tf.constant([0, 5, 3, 14], dtype=dtype)
  not_a_and_a, not_a_or_a, not_0 = [bitwise_ops.bitwise_and(
                                      input_tensor, bitwise_ops.invert(input_tensor)),
                                    bitwise_ops.bitwise_or(
                                      input_tensor, bitwise_ops.invert(input_tensor)),
                                    bitwise_ops.invert(
                                      tf.constant(0, dtype=dtype))]

  expected = tf.constant([0, 0, 0, 0], dtype=tf.float32)
  tf.assert_equal(tf.cast(not_a_and_a, tf.float32), expected)

  expected = tf.cast([not_0] * 4, tf.float32)
  tf.assert_equal(tf.cast(not_a_or_a, tf.float32), expected)

  # For unsigned dtypes let's also check the result directly.
  if dtype.is_unsigned:
    inverted = bitwise_ops.invert(input_tensor)
    expected = tf.constant([dtype.max - x for x in inputs], dtype=tf.float32)
    tf.assert_equal(tf.cast(inverted, tf.float32), tf.cast(expected, tf.float32))

Traits: Involution, SameOperandsAndResultType

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of integer values

Results:

Result Description
y tensor of integer values

tf.InvertPermutation (::mlir::TF::InvertPermutationOp)

Computes the inverse permutation of a tensor.

This operation computes the inverse of an index permutation. It takes a 1-D integer tensor x, which represents the indices of a zero-based array, and swaps each value with its index position. In other words, for an output tensor y and an input tensor x, this operation computes the following:

y[x[i]] = i for i in [0, 1, ..., len(x) - 1]

The values must include 0. There can be no duplicate values or negative values.

For example:

# tensor `x` is [3, 4, 0, 2, 1]
invert_permutation(x) ==> [2, 4, 3, 0, 1]

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of 32/64-bit signed integer values

Results:

Result Description
y tensor of 32/64-bit signed integer values

tf.IsFinite (::mlir::TF::IsFiniteOp)

Returns which elements of x are finite.

@compatibility(numpy) Equivalent to np.isfinite @end_compatibility

Example:

x = tf.constant([5.0, 4.8, 6.8, np.inf, np.nan])
tf.math.is_finite(x) ==> [True, True, True, False, False]

Traits: SameOperandsAndResultShape

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of floating-point values

Results:

Result Description
y tensor of bool values

tf.IsInf (::mlir::TF::IsInfOp)

Returns which elements of x are Inf.

@compatibility(numpy) Equivalent to np.isinf @end_compatibility

Example:

x = tf.constant([5.0, np.inf, 6.8, np.inf])
tf.math.is_inf(x) ==> [False, True, False, True]

Traits: SameOperandsAndResultShape

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of floating-point values

Results:

Result Description
y tensor of bool values

tf.IsNan (::mlir::TF::IsNanOp)

Returns which elements of x are NaN.

@compatibility(numpy) Equivalent to np.isnan @end_compatibility

Example:

x = tf.constant([5.0, np.nan, 6.8, np.nan, np.inf])
tf.math.is_nan(x) ==> [False, True, False, True, False]

Traits: SameOperandsAndResultShape

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of floating-point values

Results:

Result Description
y tensor of bool values

tf.IteratorFromStringHandle (::mlir::TF::IteratorFromStringHandleOp)

Converts the given string representing a handle to an iterator to a resource.

Attributes:

Attribute MLIR Type Description
output_types ::mlir::ArrayAttr type array attribute
output_shapes ::mlir::ArrayAttr tensorflow shape attribute array

Operands:

Operand Description
string_handle tensor of string values

Results:

Result Description
resource_handle tensor of resource values

tf.IteratorFromStringHandleV2 (::mlir::TF::IteratorFromStringHandleV2Op)

Attributes:

Attribute MLIR Type Description
output_types ::mlir::ArrayAttr type array attribute
output_shapes ::mlir::ArrayAttr tensorflow shape attribute array

Operands:

Operand Description
string_handle tensor of string values

Results:

Result Description
resource_handle tensor of resource values

tf.IteratorGetNextAsOptional (::mlir::TF::IteratorGetNextAsOptionalOp)

Gets the next output from the given iterator as an Optional variant.

Attributes:

Attribute MLIR Type Description
output_types ::mlir::ArrayAttr type array attribute with at least 1 elements
output_shapes ::mlir::ArrayAttr tensorflow shape attribute array with at least 1 elements

Operands:

Operand Description
iterator tensor of resource values

Results:

Result Description
optional tensor of variant values

tf.IteratorGetNext (::mlir::TF::IteratorGetNextOp)

Gets the next output from the given iterator .

Attributes:

Attribute MLIR Type Description
output_shapes ::mlir::Attribute derived attribute
output_types ::mlir::Attribute derived attribute

Operands:

Operand Description
iterator tensor of resource values

Results:

Result Description
components tensor of tf.dtype values

tf.IteratorGetNextSync (::mlir::TF::IteratorGetNextSyncOp)

Gets the next output from the given iterator.

This operation is a synchronous version IteratorGetNext. It should only be used in situations where the iterator does not block the calling thread, or where the calling thread is not a member of the thread pool used to execute parallel operations (e.g. in eager mode).

Attributes:

Attribute MLIR Type Description
output_shapes ::mlir::Attribute derived attribute
output_types ::mlir::Attribute derived attribute

Operands:

Operand Description
iterator tensor of resource values

Results:

Result Description
components tensor of tf.dtype values

tf.Iterator (::mlir::TF::IteratorOp)

A container for an iterator resource.

Attributes:

Attribute MLIR Type Description
shared_name ::mlir::StringAttr string attribute
container ::mlir::StringAttr string attribute
output_types ::mlir::ArrayAttr type array attribute with at least 1 elements
output_shapes ::mlir::ArrayAttr tensorflow shape attribute array with at least 1 elements

Results:

Result Description
handle tensor of resource values

tf.IteratorToStringHandle (::mlir::TF::IteratorToStringHandleOp)

Converts the given resource_handle representing an iterator to a string.

Operands:

Operand Description
resource_handle tensor of resource values

Results:

Result Description
string_handle tensor of string values

tf.IteratorV2 (::mlir::TF::IteratorV2Op)

Attributes:

Attribute MLIR Type Description
shared_name ::mlir::StringAttr string attribute
container ::mlir::StringAttr string attribute
output_types ::mlir::ArrayAttr type array attribute with at least 1 elements
output_shapes ::mlir::ArrayAttr tensorflow shape attribute array with at least 1 elements

Results:

Result Description
handle tensor of resource values

tf.KthOrderStatistic (::mlir::TF::KthOrderStatisticOp)

Computes the Kth order statistic of a data set. The current

implementation uses a binary search requiring exactly 32 passes over the input data. The running time is linear with respect to input size. The median-of-medians algorithm is probably faster, but is difficult to implement efficiently in XLA. The implementation imposes a total ordering on floats. The ordering is consistent with the usual partial order. Positive NaNs are greater than positive infinity. Negative NaNs are less than negative infinity. NaNs with distinct payloads are treated as distinct. Subnormal numbers are preserved (not flushed to zero). Positive infinity is greater than all numbers. Negative infinity is less than all numbers. Positive is greater than negative zero. There are less than k values greater than the kth order statistic. There are at least k values greater than or equal to the Kth order statistic. The semantics are not the same as top_k_unique.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
k ::mlir::IntegerAttr 64-bit signless integer attribute

Operands:

Operand Description
input tensor of 32-bit float values

Results:

Result Description
output tensor of 32-bit float values

tf.L2Loss (::mlir::TF::L2LossOp)

L2 Loss.

Computes half the L2 norm of a tensor without the sqrt:

output = sum(t ** 2) / 2

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
t tensor of floating-point values

Results:

Result Description
output tensor of floating-point values

tf.LRNGrad (::mlir::TF::LRNGradOp)

Gradients for Local Response Normalization.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
depth_radius ::mlir::IntegerAttr 64-bit signless integer attribute
bias ::mlir::FloatAttr 32-bit float attribute
alpha ::mlir::FloatAttr 32-bit float attribute
beta ::mlir::FloatAttr 32-bit float attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input_grads tensor of bfloat16 or 16-bit float or 32-bit float values
input_image tensor of bfloat16 or 16-bit float or 32-bit float values
output_image tensor of bfloat16 or 16-bit float or 32-bit float values

Results:

Result Description
output tensor of bfloat16 or 16-bit float or 32-bit float values

tf.LRN (::mlir::TF::LRNOp)

Local Response Normalization.

The 4-D input tensor is treated as a 3-D array of 1-D vectors (along the last dimension), and each vector is normalized independently. Within a given vector, each component is divided by the weighted, squared sum of inputs within depth_radius. In detail,

sqr_sum[a, b, c, d] =
    sum(input[a, b, c, d - depth_radius : d + depth_radius + 1] ** 2)
output = input / (bias + alpha * sqr_sum) ** beta

For details, see Krizhevsky et al., ImageNet classification with deep convolutional neural networks (NIPS 2012).

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
depth_radius ::mlir::IntegerAttr 64-bit signless integer attribute
bias ::mlir::FloatAttr 32-bit float attribute
alpha ::mlir::FloatAttr 32-bit float attribute
beta ::mlir::FloatAttr 32-bit float attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of bfloat16 or 16-bit float or 32-bit float values

Results:

Result Description
output tensor of bfloat16 or 16-bit float or 32-bit float values

tf.LeakyReluGrad (::mlir::TF::LeakyReluGradOp)

Computes rectified linear gradients for a LeakyRelu operation.

Traits: TF_SameOperandsAndResultTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
alpha ::mlir::FloatAttr 32-bit float attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
gradients tensor of floating-point values
features tensor of floating-point values

Results:

Result Description
backprops tensor of floating-point values

tf.LeakyRelu (::mlir::TF::LeakyReluOp)

Computes rectified linear: max(features, features * alpha).

Traits: TF_SameOperandsAndResultTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
alpha ::mlir::FloatAttr 32-bit float attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
features tensor of floating-point values

Results:

Result Description
activations tensor of floating-point values

tf.LeftShift (::mlir::TF::LeftShiftOp)

Elementwise computes the bitwise left-shift of x and y.

If y is negative, or greater than or equal to the width of x in bits the result is implementation defined.

Example:

import tensorflow as tf
from tensorflow.python.ops import bitwise_ops
import numpy as np
dtype_list = [tf.int8, tf.int16, tf.int32, tf.int64]

for dtype in dtype_list:
  lhs = tf.constant([-1, -5, -3, -14], dtype=dtype)
  rhs = tf.constant([5, 0, 7, 11], dtype=dtype)

  left_shift_result = bitwise_ops.left_shift(lhs, rhs)

  print(left_shift_result)

# This will print:
# tf.Tensor([ -32   -5 -128    0], shape=(4,), dtype=int8)
# tf.Tensor([   -32     -5   -384 -28672], shape=(4,), dtype=int16)
# tf.Tensor([   -32     -5   -384 -28672], shape=(4,), dtype=int32)
# tf.Tensor([   -32     -5   -384 -28672], shape=(4,), dtype=int64)

lhs = np.array([-2, 64, 101, 32], dtype=np.int8)
rhs = np.array([-1, -5, -3, -14], dtype=np.int8)
bitwise_ops.left_shift(lhs, rhs)
# <tf.Tensor: shape=(4,), dtype=int8, numpy=array([ -2,  64, 101,  32], dtype=int8)>

Traits: ResultsBroadcastableShape

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of integer values
y tensor of integer values

Results:

Result Description
z tensor of integer values

tf.LegacyCall (::mlir::TF::LegacyCallOp)

returns f(inputs), where f is a function.

The LegacyCall operation represents a direct call to a function that is within the same symbol scope as the call and is mapped to a GraphDef node with the function name as the op name. Unlike a PartitionedCall which represents asynchronously executing a function across multiple devices, a LegacyCall ignores specification for ops in the attached function and instead executes it on the device assigned to this op.

Interfaces: CallOpInterface, NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
f ::mlir::FlatSymbolRefAttr flat symbol reference attribute
_disable_call_shape_inference ::mlir::BoolAttr bool attribute

Operands:

Operand Description
args tensor of tf.dtype values

Results:

Result Description
output tensor of tf.dtype values

tf.LessEqual (::mlir::TF::LessEqualOp)

Returns the truth value of (x <= y) element-wise.

Example:

x = tf.constant([5, 4, 6])
y = tf.constant([5])
tf.math.less_equal(x, y) ==> [True, True, False]

x = tf.constant([5, 4, 6])
y = tf.constant([5, 6, 6])
tf.math.less_equal(x, y) ==> [True, True, True]

Traits: ResultsBroadcastableShape

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of integer or floating-point values
y tensor of integer or floating-point values

Results:

Result Description
z tensor of bool values

tf.Less (::mlir::TF::LessOp)

Returns the truth value of (x < y) element-wise.

Example:

x = tf.constant([5, 4, 6])
y = tf.constant([5])
tf.math.less(x, y) ==> [False, True, False]

x = tf.constant([5, 4, 6])
y = tf.constant([5, 6, 7])
tf.math.less(x, y) ==> [False, True, True]

Traits: ResultsBroadcastableShape

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of integer or floating-point values
y tensor of integer or floating-point values

Results:

Result Description
z tensor of bool values

tf.Lgamma (::mlir::TF::LgammaOp)

Computes the log of the absolute value of Gamma(x) element-wise.

For positive numbers, this function computes log((input - 1)!) for every element in the tensor. lgamma(5) = log((5-1)!) = log(4!) = log(24) = 3.1780539

Example:

x = tf.constant([0, 0.5, 1, 4.5, -4, -5.6])
tf.math.lgamma(x) ==> [inf, 0.5723649, 0., 2.4537368, inf, -4.6477685]

Traits: TF_SameOperandsAndResultTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of floating-point values

Results:

Result Description
y tensor of floating-point values

tf.LinSpace (::mlir::TF::LinSpaceOp)

Generates values in an interval.

A sequence of num evenly-spaced values are generated beginning at start. If num > 1, the values in the sequence increase by stop - start / num - 1, so that the last one is exactly stop.

For example:

tf.linspace(10.0, 12.0, 3, name="linspace") => [ 10.0  11.0  12.0]

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute
Tidx ::mlir::Attribute derived attribute

Operands:

Operand Description
start tensor of floating-point values
stop tensor of floating-point values
num tensor of 32/64-bit signed integer values

Results:

Result Description
output tensor of floating-point values

tf.ListDiff (::mlir::TF::ListDiffOp)

Computes the difference between two lists of numbers or strings.

Given a list x and a list y, this operation returns a list out that represents all values that are in x but not in y. The returned list out is sorted in the same order that the numbers appear in x (duplicates are preserved). This operation also returns a list idx that represents the position of each out element in x. In other words:

out[i] = x[idx[i]] for i in [0, 1, ..., len(out) - 1]

For example, given this input:

x = [1, 2, 3, 4, 5, 6]
y = [1, 3, 5]

This operation would return:

out ==> [2, 4, 6]
idx ==> [1, 3, 5]

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute
out_idx ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of tf.dtype values
y tensor of tf.dtype values

Results:

Result Description
out tensor of tf.dtype values
idx tensor of 32/64-bit signed integer values

tf.LoadTPUEmbeddingADAMParametersGradAccumDebug (::mlir::TF::LoadTPUEmbeddingADAMParametersGradAccumDebugOp)

Interfaces: TF_MustExecute (MemoryEffectOpInterface), TF_TPUEmbeddingReadEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::TF::ResourceEffects::TPUEmbedding}, MemoryEffects::Effect{MemoryEffects::Write on ::mlir::TF::ResourceEffects::MustExecute}

Attributes:

Attribute MLIR Type Description
table_id ::mlir::IntegerAttr 64-bit signless integer attribute
table_name ::mlir::StringAttr string attribute
num_shards ::mlir::IntegerAttr 64-bit signless integer attribute
shard_id ::mlir::IntegerAttr 64-bit signless integer attribute
config ::mlir::StringAttr string attribute

Operands:

Operand Description
parameters tensor of 32-bit float values
momenta tensor of 32-bit float values
velocities tensor of 32-bit float values
gradient_accumulators tensor of 32-bit float values

tf.LoadTPUEmbeddingADAMParameters (::mlir::TF::LoadTPUEmbeddingADAMParametersOp)

Load ADAM embedding parameters.

An op that loads optimization parameters into HBM for embedding. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up the correct embedding table configuration. For example, this op is used to install parameters that are loaded from a checkpoint before a training loop is executed.

Interfaces: TF_MustExecute (MemoryEffectOpInterface), TF_TPUEmbeddingReadEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::TF::ResourceEffects::TPUEmbedding}, MemoryEffects::Effect{MemoryEffects::Write on ::mlir::TF::ResourceEffects::MustExecute}

Attributes:

Attribute MLIR Type Description
table_id ::mlir::IntegerAttr 64-bit signless integer attribute
table_name ::mlir::StringAttr string attribute
num_shards ::mlir::IntegerAttr 64-bit signless integer attribute
shard_id ::mlir::IntegerAttr 64-bit signless integer attribute
config ::mlir::StringAttr string attribute

Operands:

Operand Description
parameters tensor of 32-bit float values
momenta tensor of 32-bit float values
velocities tensor of 32-bit float values

tf.LoadTPUEmbeddingAdadeltaParametersGradAccumDebug (::mlir::TF::LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOp)

Interfaces: TF_MustExecute (MemoryEffectOpInterface), TF_TPUEmbeddingReadEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::TF::ResourceEffects::TPUEmbedding}, MemoryEffects::Effect{MemoryEffects::Write on ::mlir::TF::ResourceEffects::MustExecute}

Attributes:

Attribute MLIR Type Description
table_id ::mlir::IntegerAttr 64-bit signless integer attribute
table_name ::mlir::StringAttr string attribute
num_shards ::mlir::IntegerAttr 64-bit signless integer attribute
shard_id ::mlir::IntegerAttr 64-bit signless integer attribute
config ::mlir::StringAttr string attribute

Operands:

Operand Description
parameters tensor of 32-bit float values
accumulators tensor of 32-bit float values
updates tensor of 32-bit float values
gradient_accumulators tensor of 32-bit float values

tf.LoadTPUEmbeddingAdadeltaParameters (::mlir::TF::LoadTPUEmbeddingAdadeltaParametersOp)

Load Adadelta embedding parameters.

An op that loads optimization parameters into HBM for embedding. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up the correct embedding table configuration. For example, this op is used to install parameters that are loaded from a checkpoint before a training loop is executed.

Interfaces: TF_MustExecute (MemoryEffectOpInterface), TF_TPUEmbeddingReadEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::TF::ResourceEffects::TPUEmbedding}, MemoryEffects::Effect{MemoryEffects::Write on ::mlir::TF::ResourceEffects::MustExecute}

Attributes:

Attribute MLIR Type Description
table_id ::mlir::IntegerAttr 64-bit signless integer attribute
table_name ::mlir::StringAttr string attribute
num_shards ::mlir::IntegerAttr 64-bit signless integer attribute
shard_id ::mlir::IntegerAttr 64-bit signless integer attribute
config ::mlir::StringAttr string attribute

Operands:

Operand Description
parameters tensor of 32-bit float values
accumulators tensor of 32-bit float values
updates tensor of 32-bit float values

tf.LoadTPUEmbeddingAdagradParametersGradAccumDebug (::mlir::TF::LoadTPUEmbeddingAdagradParametersGradAccumDebugOp)

Interfaces: TF_MustExecute (MemoryEffectOpInterface), TF_TPUEmbeddingReadEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::TF::ResourceEffects::TPUEmbedding}, MemoryEffects::Effect{MemoryEffects::Write on ::mlir::TF::ResourceEffects::MustExecute}

Attributes:

Attribute MLIR Type Description
table_id ::mlir::IntegerAttr 64-bit signless integer attribute
table_name ::mlir::StringAttr string attribute
num_shards ::mlir::IntegerAttr 64-bit signless integer attribute
shard_id ::mlir::IntegerAttr 64-bit signless integer attribute
config ::mlir::StringAttr string attribute

Operands:

Operand Description
parameters tensor of 32-bit float values
accumulators tensor of 32-bit float values
gradient_accumulators tensor of 32-bit float values

tf.LoadTPUEmbeddingAdagradParameters (::mlir::TF::LoadTPUEmbeddingAdagradParametersOp)

Load Adagrad embedding parameters.

An op that loads optimization parameters into HBM for embedding. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up the correct embedding table configuration. For example, this op is used to install parameters that are loaded from a checkpoint before a training loop is executed.

Interfaces: TF_MustExecute (MemoryEffectOpInterface), TF_TPUEmbeddingReadEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::TF::ResourceEffects::TPUEmbedding}, MemoryEffects::Effect{MemoryEffects::Write on ::mlir::TF::ResourceEffects::MustExecute}

Attributes:

Attribute MLIR Type Description
table_id ::mlir::IntegerAttr 64-bit signless integer attribute
table_name ::mlir::StringAttr string attribute
num_shards ::mlir::IntegerAttr 64-bit signless integer attribute
shard_id ::mlir::IntegerAttr 64-bit signless integer attribute
config ::mlir::StringAttr string attribute

Operands:

Operand Description
parameters tensor of 32-bit float values
accumulators tensor of 32-bit float values

tf.LoadTPUEmbeddingCenteredRMSPropParameters (::mlir::TF::LoadTPUEmbeddingCenteredRMSPropParametersOp)

Load centered RMSProp embedding parameters.

An op that loads optimization parameters into HBM for embedding. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up the correct embedding table configuration. For example, this op is used to install parameters that are loaded from a checkpoint before a training loop is executed.

Interfaces: TF_MustExecute (MemoryEffectOpInterface), TF_TPUEmbeddingReadEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::TF::ResourceEffects::TPUEmbedding}, MemoryEffects::Effect{MemoryEffects::Write on ::mlir::TF::ResourceEffects::MustExecute}

Attributes:

Attribute MLIR Type Description
table_id ::mlir::IntegerAttr 64-bit signless integer attribute
table_name ::mlir::StringAttr string attribute
num_shards ::mlir::IntegerAttr 64-bit signless integer attribute
shard_id ::mlir::IntegerAttr 64-bit signless integer attribute
config ::mlir::StringAttr string attribute

Operands:

Operand Description
parameters tensor of 32-bit float values
ms tensor of 32-bit float values
mom tensor of 32-bit float values
mg tensor of 32-bit float values

tf.LoadTPUEmbeddingFTRLParametersGradAccumDebug (::mlir::TF::LoadTPUEmbeddingFTRLParametersGradAccumDebugOp)

Interfaces: TF_MustExecute (MemoryEffectOpInterface), TF_TPUEmbeddingReadEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::TF::ResourceEffects::TPUEmbedding}, MemoryEffects::Effect{MemoryEffects::Write on ::mlir::TF::ResourceEffects::MustExecute}

Attributes:

Attribute MLIR Type Description
table_id ::mlir::IntegerAttr 64-bit signless integer attribute
table_name ::mlir::StringAttr string attribute
num_shards ::mlir::IntegerAttr 64-bit signless integer attribute
shard_id ::mlir::IntegerAttr 64-bit signless integer attribute
config ::mlir::StringAttr string attribute

Operands:

Operand Description
parameters tensor of 32-bit float values
accumulators tensor of 32-bit float values
linears tensor of 32-bit float values
gradient_accumulators tensor of 32-bit float values

tf.LoadTPUEmbeddingFTRLParameters (::mlir::TF::LoadTPUEmbeddingFTRLParametersOp)

Load FTRL embedding parameters.

An op that loads optimization parameters into HBM for embedding. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up the correct embedding table configuration. For example, this op is used to install parameters that are loaded from a checkpoint before a training loop is executed.

Interfaces: TF_MustExecute (MemoryEffectOpInterface), TF_TPUEmbeddingReadEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::TF::ResourceEffects::TPUEmbedding}, MemoryEffects::Effect{MemoryEffects::Write on ::mlir::TF::ResourceEffects::MustExecute}

Attributes:

Attribute MLIR Type Description
table_id ::mlir::IntegerAttr 64-bit signless integer attribute
table_name ::mlir::StringAttr string attribute
num_shards ::mlir::IntegerAttr 64-bit signless integer attribute
shard_id ::mlir::IntegerAttr 64-bit signless integer attribute
config ::mlir::StringAttr string attribute

Operands:

Operand Description
parameters tensor of 32-bit float values
accumulators tensor of 32-bit float values
linears tensor of 32-bit float values

tf.LoadTPUEmbeddingMDLAdagradLightParameters (::mlir::TF::LoadTPUEmbeddingMDLAdagradLightParametersOp)

Load MDL Adagrad Light embedding parameters.

An op that loads optimization parameters into HBM for embedding. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up the correct embedding table configuration. For example, this op is used to install parameters that are loaded from a checkpoint before a training loop is executed.

Interfaces: TF_MustExecute (MemoryEffectOpInterface), TF_TPUEmbeddingReadEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::TF::ResourceEffects::TPUEmbedding}, MemoryEffects::Effect{MemoryEffects::Write on ::mlir::TF::ResourceEffects::MustExecute}

Attributes:

Attribute MLIR Type Description
table_id ::mlir::IntegerAttr 64-bit signless integer attribute
table_name ::mlir::StringAttr string attribute
num_shards ::mlir::IntegerAttr 64-bit signless integer attribute
shard_id ::mlir::IntegerAttr 64-bit signless integer attribute
config ::mlir::StringAttr string attribute

Operands:

Operand Description
parameters tensor of 32-bit float values
accumulators tensor of 32-bit float values
weights tensor of 32-bit float values
benefits tensor of 32-bit float values

tf.LoadTPUEmbeddingMomentumParametersGradAccumDebug (::mlir::TF::LoadTPUEmbeddingMomentumParametersGradAccumDebugOp)

Interfaces: TF_MustExecute (MemoryEffectOpInterface), TF_TPUEmbeddingReadEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::TF::ResourceEffects::TPUEmbedding}, MemoryEffects::Effect{MemoryEffects::Write on ::mlir::TF::ResourceEffects::MustExecute}

Attributes:

Attribute MLIR Type Description
table_id ::mlir::IntegerAttr 64-bit signless integer attribute
table_name ::mlir::StringAttr string attribute
num_shards ::mlir::IntegerAttr 64-bit signless integer attribute
shard_id ::mlir::IntegerAttr 64-bit signless integer attribute
config ::mlir::StringAttr string attribute

Operands:

Operand Description
parameters tensor of 32-bit float values
momenta tensor of 32-bit float values
gradient_accumulators tensor of 32-bit float values

tf.LoadTPUEmbeddingMomentumParameters (::mlir::TF::LoadTPUEmbeddingMomentumParametersOp)

Load Momentum embedding parameters.

An op that loads optimization parameters into HBM for embedding. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up the correct embedding table configuration. For example, this op is used to install parameters that are loaded from a checkpoint before a training loop is executed.

Interfaces: TF_MustExecute (MemoryEffectOpInterface), TF_TPUEmbeddingReadEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::TF::ResourceEffects::TPUEmbedding}, MemoryEffects::Effect{MemoryEffects::Write on ::mlir::TF::ResourceEffects::MustExecute}

Attributes:

Attribute MLIR Type Description
table_id ::mlir::IntegerAttr 64-bit signless integer attribute
table_name ::mlir::StringAttr string attribute
num_shards ::mlir::IntegerAttr 64-bit signless integer attribute
shard_id ::mlir::IntegerAttr 64-bit signless integer attribute
config ::mlir::StringAttr string attribute

Operands:

Operand Description
parameters tensor of 32-bit float values
momenta tensor of 32-bit float values

tf.LoadTPUEmbeddingProximalAdagradParametersGradAccumDebug (::mlir::TF::LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOp)

Interfaces: TF_MustExecute (MemoryEffectOpInterface), TF_TPUEmbeddingReadEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::TF::ResourceEffects::TPUEmbedding}, MemoryEffects::Effect{MemoryEffects::Write on ::mlir::TF::ResourceEffects::MustExecute}

Attributes:

Attribute MLIR Type Description
table_id ::mlir::IntegerAttr 64-bit signless integer attribute
table_name ::mlir::StringAttr string attribute
num_shards ::mlir::IntegerAttr 64-bit signless integer attribute
shard_id ::mlir::IntegerAttr 64-bit signless integer attribute
config ::mlir::StringAttr string attribute

Operands:

Operand Description
parameters tensor of 32-bit float values
accumulators tensor of 32-bit float values
gradient_accumulators tensor of 32-bit float values

tf.LoadTPUEmbeddingProximalAdagradParameters (::mlir::TF::LoadTPUEmbeddingProximalAdagradParametersOp)

Load proximal Adagrad embedding parameters.

An op that loads optimization parameters into HBM for embedding. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up the correct embedding table configuration. For example, this op is used to install parameters that are loaded from a checkpoint before a training loop is executed.

Interfaces: TF_MustExecute (MemoryEffectOpInterface), TF_TPUEmbeddingReadEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::TF::ResourceEffects::TPUEmbedding}, MemoryEffects::Effect{MemoryEffects::Write on ::mlir::TF::ResourceEffects::MustExecute}

Attributes:

Attribute MLIR Type Description
table_id ::mlir::IntegerAttr 64-bit signless integer attribute
table_name ::mlir::StringAttr string attribute
num_shards ::mlir::IntegerAttr 64-bit signless integer attribute
shard_id ::mlir::IntegerAttr 64-bit signless integer attribute
config ::mlir::StringAttr string attribute

Operands:

Operand Description
parameters tensor of 32-bit float values
accumulators tensor of 32-bit float values

tf.LoadTPUEmbeddingProximalYogiParametersGradAccumDebug (::mlir::TF::LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOp)

Interfaces: TF_MustExecute (MemoryEffectOpInterface), TF_TPUEmbeddingReadEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::TF::ResourceEffects::TPUEmbedding}, MemoryEffects::Effect{MemoryEffects::Write on ::mlir::TF::ResourceEffects::MustExecute}

Attributes:

Attribute MLIR Type Description
table_id ::mlir::IntegerAttr 64-bit signless integer attribute
table_name ::mlir::StringAttr string attribute
num_shards ::mlir::IntegerAttr 64-bit signless integer attribute
shard_id ::mlir::IntegerAttr 64-bit signless integer attribute
config ::mlir::StringAttr string attribute

Operands:

Operand Description
parameters tensor of 32-bit float values
v tensor of 32-bit float values
m tensor of 32-bit float values
gradient_accumulators tensor of 32-bit float values

tf.LoadTPUEmbeddingProximalYogiParameters (::mlir::TF::LoadTPUEmbeddingProximalYogiParametersOp)

Interfaces: TF_MustExecute (MemoryEffectOpInterface), TF_TPUEmbeddingReadEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::TF::ResourceEffects::TPUEmbedding}, MemoryEffects::Effect{MemoryEffects::Write on ::mlir::TF::ResourceEffects::MustExecute}

Attributes:

Attribute MLIR Type Description
table_id ::mlir::IntegerAttr 64-bit signless integer attribute
table_name ::mlir::StringAttr string attribute
num_shards ::mlir::IntegerAttr 64-bit signless integer attribute
shard_id ::mlir::IntegerAttr 64-bit signless integer attribute
config ::mlir::StringAttr string attribute

Operands:

Operand Description
parameters tensor of 32-bit float values
v tensor of 32-bit float values
m tensor of 32-bit float values

tf.LoadTPUEmbeddingRMSPropParametersGradAccumDebug (::mlir::TF::LoadTPUEmbeddingRMSPropParametersGradAccumDebugOp)

Interfaces: TF_MustExecute (MemoryEffectOpInterface), TF_TPUEmbeddingReadEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::TF::ResourceEffects::TPUEmbedding}, MemoryEffects::Effect{MemoryEffects::Write on ::mlir::TF::ResourceEffects::MustExecute}

Attributes:

Attribute MLIR Type Description
table_id ::mlir::IntegerAttr 64-bit signless integer attribute
table_name ::mlir::StringAttr string attribute
num_shards ::mlir::IntegerAttr 64-bit signless integer attribute
shard_id ::mlir::IntegerAttr 64-bit signless integer attribute
config ::mlir::StringAttr string attribute

Operands:

Operand Description
parameters tensor of 32-bit float values
ms tensor of 32-bit float values
mom tensor of 32-bit float values
gradient_accumulators tensor of 32-bit float values

tf.LoadTPUEmbeddingRMSPropParameters (::mlir::TF::LoadTPUEmbeddingRMSPropParametersOp)

Load RMSProp embedding parameters.

An op that loads optimization parameters into HBM for embedding. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up the correct embedding table configuration. For example, this op is used to install parameters that are loaded from a checkpoint before a training loop is executed.

Interfaces: TF_MustExecute (MemoryEffectOpInterface), TF_TPUEmbeddingReadEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::TF::ResourceEffects::TPUEmbedding}, MemoryEffects::Effect{MemoryEffects::Write on ::mlir::TF::ResourceEffects::MustExecute}

Attributes:

Attribute MLIR Type Description
table_id ::mlir::IntegerAttr 64-bit signless integer attribute
table_name ::mlir::StringAttr string attribute
num_shards ::mlir::IntegerAttr 64-bit signless integer attribute
shard_id ::mlir::IntegerAttr 64-bit signless integer attribute
config ::mlir::StringAttr string attribute

Operands:

Operand Description
parameters tensor of 32-bit float values
ms tensor of 32-bit float values
mom tensor of 32-bit float values

tf.LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebug (::mlir::TF::LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOp)

Interfaces: TF_MustExecute (MemoryEffectOpInterface), TF_TPUEmbeddingReadEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::TF::ResourceEffects::TPUEmbedding}, MemoryEffects::Effect{MemoryEffects::Write on ::mlir::TF::ResourceEffects::MustExecute}

Attributes:

Attribute MLIR Type Description
table_id ::mlir::IntegerAttr 64-bit signless integer attribute
table_name ::mlir::StringAttr string attribute
num_shards ::mlir::IntegerAttr 64-bit signless integer attribute
shard_id ::mlir::IntegerAttr 64-bit signless integer attribute
config ::mlir::StringAttr string attribute

Operands:

Operand Description
parameters tensor of 32-bit float values
gradient_accumulators tensor of 32-bit float values

tf.LoadTPUEmbeddingStochasticGradientDescentParameters (::mlir::TF::LoadTPUEmbeddingStochasticGradientDescentParametersOp)

Load SGD embedding parameters.

An op that loads optimization parameters into HBM for embedding. Must be preceded by a ConfigureTPUEmbeddingHost op that sets up the correct embedding table configuration. For example, this op is used to install parameters that are loaded from a checkpoint before a training loop is executed.

Interfaces: TF_MustExecute (MemoryEffectOpInterface), TF_TPUEmbeddingReadEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::TF::ResourceEffects::TPUEmbedding}, MemoryEffects::Effect{MemoryEffects::Write on ::mlir::TF::ResourceEffects::MustExecute}

Attributes:

Attribute MLIR Type Description
table_id ::mlir::IntegerAttr 64-bit signless integer attribute
table_name ::mlir::StringAttr string attribute
num_shards ::mlir::IntegerAttr 64-bit signless integer attribute
shard_id ::mlir::IntegerAttr 64-bit signless integer attribute
config ::mlir::StringAttr string attribute

Operands:

Operand Description
parameters tensor of 32-bit float values

tf.Log1p (::mlir::TF::Log1pOp)

Computes natural logarithm of (1 + x) element-wise.

I.e., \(y = \log_e (1 + x)\).

Example:

x = tf.constant([0, 0.5, 1, 5])
tf.math.log1p(x) ==> [0., 0.4054651, 0.6931472, 1.7917595]

Traits: SameOperandsAndResultType, TF_CwiseUnary

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of floating-point or complex values

Results:

Result Description
y tensor of floating-point or complex values

tf.Log (::mlir::TF::LogOp)

Computes natural logarithm of x element-wise.

I.e., \(y = \log_e x\).

Example:

x = tf.constant([0, 0.5, 1, 5])
tf.math.log(x) ==> [-inf, -0.6931472,  0. ,  1.609438]

Traits: SameOperandsAndResultType

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of floating-point or complex values

Results:

Result Description
y tensor of floating-point or complex values

tf.LogSoftmax (::mlir::TF::LogSoftmaxOp)

Computes log softmax activations.

For each batch i and class j we have

logsoftmax[i, j] = logits[i, j] - log(sum(exp(logits[i])))

Traits: SameOperandsAndResultType

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
logits tensor of floating-point values

Results:

Result Description
logsoftmax tensor of floating-point values

tf.LogicalAnd (::mlir::TF::LogicalAndOp)

Returns the truth value of x AND y element-wise.

Traits: Commutative, ResultsBroadcastableShape

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

Operand Description
x tensor of bool values
y tensor of bool values

Results:

Result Description
z tensor of bool values

tf.LogicalNot (::mlir::TF::LogicalNotOp)

Returns the truth value of NOT x element-wise.

Traits: Involution, SameOperandsAndResultType

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

Operand Description
x tensor of bool values

Results:

Result Description
y tensor of bool values

tf.LogicalOr (::mlir::TF::LogicalOrOp)

Returns the truth value of x OR y element-wise.

Traits: Commutative, ResultsBroadcastableShape

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

Operand Description
x tensor of bool values
y tensor of bool values

Results:

Result Description
z tensor of bool values

tf.LookupTableExportV2 (::mlir::TF::LookupTableExportV2Op)

Outputs all keys and values in the table.

Attributes:

Attribute MLIR Type Description
Tkeys ::mlir::Attribute derived attribute
Tvalues ::mlir::Attribute derived attribute

Operands:

Operand Description
table_handle tensor of resource values

Results:

Result Description
keys tensor of tf.dtype values
values tensor of tf.dtype values

tf.LookupTableFind (::mlir::TF::LookupTableFindOp)

Looks up keys in a table, outputs the corresponding values.

The tensor keys must of the same type as the keys of the table. The output values is of the type of the table values.

The scalar default_value is the value output for keys not present in the table. It must also be of the same type as the table values.

Attributes:

Attribute MLIR Type Description
Tin ::mlir::Attribute derived attribute
Tout ::mlir::Attribute derived attribute

Operands:

Operand Description
table_handle tensor of string values
keys tensor of tf.dtype values
default_value tensor of tf.dtype values

Results:

Result Description
values tensor of tf.dtype values

tf.LookupTableFindV2 (::mlir::TF::LookupTableFindV2Op)

Looks up keys in a table, outputs the corresponding values.

The tensor keys must of the same type as the keys of the table. The output values is of the type of the table values.

The scalar default_value is the value output for keys not present in the table. It must also be of the same type as the table values.

Attributes:

Attribute MLIR Type Description
Tin ::mlir::Attribute derived attribute
Tout ::mlir::Attribute derived attribute

Operands:

Operand Description
table_handle tensor of resource values
keys tensor of tf.dtype values
default_value tensor of tf.dtype values

Results:

Result Description
values tensor of tf.dtype values

tf.LookupTableImportV2 (::mlir::TF::LookupTableImportV2Op)

Replaces the contents of the table with the specified keys and values.

The tensor keys must be of the same type as the keys of the table. The tensor values must be of the type of the table values.

Attributes:

Attribute MLIR Type Description
Tin ::mlir::Attribute derived attribute
Tout ::mlir::Attribute derived attribute

Operands:

Operand Description
table_handle tensor of resource values
keys tensor of tf.dtype values
values tensor of tf.dtype values

tf.LookupTableInsertV2 (::mlir::TF::LookupTableInsertV2Op)

Updates the table to associates keys with values.

The tensor keys must be of the same type as the keys of the table. The tensor values must be of the type of the table values.

Attributes:

Attribute MLIR Type Description
Tin ::mlir::Attribute derived attribute
Tout ::mlir::Attribute derived attribute

Operands:

Operand Description
table_handle tensor of resource values
keys tensor of tf.dtype values
values tensor of tf.dtype values

tf.LookupTableRemoveV2 (::mlir::TF::LookupTableRemoveV2Op)

Removes keys and its associated values from a table.

The tensor keys must of the same type as the keys of the table. Keys not already in the table are silently ignored.

Attributes:

Attribute MLIR Type Description
Tin ::mlir::Attribute derived attribute

Operands:

Operand Description
table_handle tensor of resource values
keys tensor of tf.dtype values

tf.LookupTableSize (::mlir::TF::LookupTableSizeOp)

Computes the number of elements in the given table.

Operands:

Operand Description
table_handle tensor of string values

Results:

Result Description
size tensor of 64-bit integer values

tf.LookupTableSizeV2 (::mlir::TF::LookupTableSizeV2Op)

Computes the number of elements in the given table.

Operands:

Operand Description
table_handle tensor of resource values

Results:

Result Description
size tensor of 64-bit integer values

tf.LowerBound (::mlir::TF::LowerBoundOp)

Applies lower_bound(sorted_search_values, values) along each row.

Each set of rows with the same index in (sorted_inputs, values) is treated independently. The resulting row is the equivalent of calling np.searchsorted(sorted_inputs, values, side='left').

The result is not a global index to the entire Tensor, but rather just the index in the last dimension.

A 2-D example: sorted_sequence = [[0, 3, 9, 9, 10], [1, 2, 3, 4, 5]] values = [[2, 4, 9], [0, 2, 6]]

result = LowerBound(sorted_sequence, values)

result == [[1, 2, 2], [0, 1, 5]]

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute
out_type ::mlir::Attribute derived attribute

Operands:

Operand Description
sorted_inputs tensor of tf.dtype values
values tensor of tf.dtype values

Results:

Result Description
output tensor of 32/64-bit signed integer values

tf.MakeIterator (::mlir::TF::MakeIteratorOp)

Makes a new iterator from the given dataset and stores it in iterator.

This operation may be executed multiple times. Each execution will reset the iterator in iterator to the first element of dataset.

Operands:

Operand Description
dataset tensor of variant values
iterator tensor of resource values

tf.MakeUnique (::mlir::TF::MakeUniqueOp)

Make all elements in the non-Batch dimension unique, but "close" to

their initial value. Never returns a sub-normal number. Never returns zero. The sign of each input element is always identical to the sign of the corresponding output element. Behavior for infinite elements is undefined. Behavior for subnormal elements is undefined.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

Operand Description
input tensor of 32-bit float values

Results:

Result Description
output tensor of 32-bit float values

tf.MapAndBatchDataset (::mlir::TF::MapAndBatchDatasetOp)

Creates a dataset that fuses mapping with batching.

Creates a dataset that applies f to the outputs of input_dataset and then batches batch_size of them.

Unlike a "MapDataset", which applies f sequentially, this dataset invokes up to batch_size * num_parallel_batches copies of f in parallel.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
f ::mlir::SymbolRefAttr symbol reference attribute
output_types ::mlir::ArrayAttr type array attribute with at least 1 elements
output_shapes ::mlir::ArrayAttr tensorflow shape attribute array with at least 1 elements
preserve_cardinality ::mlir::BoolAttr bool attribute
metadata ::mlir::StringAttr string attribute
Targuments ::mlir::Attribute derived attribute

Operands:

Operand Description
input_dataset tensor of variant values
other_arguments tensor of tf.dtype values
batch_size tensor of 64-bit integer values
num_parallel_calls tensor of 64-bit integer values
drop_remainder tensor of bool values

Results:

Result Description
handle tensor of variant values

tf.MapDataset (::mlir::TF::MapDatasetOp)

Creates a dataset that applies f to the outputs of input_dataset.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
f ::mlir::SymbolRefAttr symbol reference attribute
output_types ::mlir::ArrayAttr type array attribute with at least 1 elements
output_shapes ::mlir::ArrayAttr tensorflow shape attribute array with at least 1 elements
use_inter_op_parallelism ::mlir::BoolAttr bool attribute
preserve_cardinality ::mlir::BoolAttr bool attribute
metadata ::mlir::StringAttr string attribute
Targuments ::mlir::Attribute derived attribute

Operands:

Operand Description
input_dataset tensor of variant values
other_arguments tensor of tf.dtype values

Results:

Result Description
handle tensor of variant values

tf.MatMul (::mlir::TF::MatMulOp)

Multiply the matrix "a" by the matrix "b".

The inputs must be two-dimensional matrices and the inner dimension of "a" (after being transposed if transpose_a is true) must match the outer dimension of "b" (after being transposed if transposed_b is true).

Traits: TF_SameOperandsAndResultElementTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
transpose_a ::mlir::BoolAttr bool attribute
transpose_b ::mlir::BoolAttr bool attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
a tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 32-bit integer or 64-bit integer values
b tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 32-bit integer or 64-bit integer values

Results:

Result Description
product tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 32-bit integer or 64-bit integer values

tf.MatrixBandPart (::mlir::TF::MatrixBandPartOp)

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).

For example:

# if 'input' is [[ 0,  1,  2, 3]
#                [-1,  0,  1, 2]
#                [-2, -1,  0, 1]
#                [-3, -2, -1, 0]],

tf.linalg.band_part(input, 1, -1) ==> [[ 0,  1,  2, 3]
                                       [-1,  0,  1, 2]
                                       [ 0, -1,  0, 1]
                                       [ 0,  0, -1, 0]],

tf.linalg.band_part(input, 2, 1) ==> [[ 0,  1,  0, 0]
                                      [-1,  0,  1, 0]
                                      [-2, -1,  0, 1]
                                      [ 0, -2, -1, 0]]

Useful special cases:

 tf.linalg.band_part(input, 0, -1) ==> Upper triangular part.
 tf.linalg.band_part(input, -1, 0) ==> Lower triangular part.
 tf.linalg.band_part(input, 0, 0) ==> Diagonal.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute
Tindex ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of tf.dtype values
num_lower tensor of 32/64-bit signed integer values
num_upper tensor of 32/64-bit signed integer values

Results:

Result Description
band tensor of tf.dtype values

tf.MatrixDiag (::mlir::TF::MatrixDiagOp)

Returns a batched diagonal tensor with a given batched diagonal values.

Given a diagonal, this operation returns a tensor with the diagonal and everything else padded with zeros. The diagonal is computed as follows:

Assume diagonal has k dimensions [I, J, K, ..., N], then the output is a tensor of rank k+1 with dimensions [I, J, K, ..., N, N]` where:

output[i, j, k, ..., m, n] = 1{m=n} * diagonal[i, j, k, ..., n].

For example:

# 'diagonal' is [[1, 2, 3, 4], [5, 6, 7, 8]]

and diagonal.shape = (2, 4)

tf.matrix_diag(diagonal) ==> [[[1, 0, 0, 0]
                                     [0, 2, 0, 0]
                                     [0, 0, 3, 0]
                                     [0, 0, 0, 4]],
                                    [[5, 0, 0, 0]
                                     [0, 6, 0, 0]
                                     [0, 0, 7, 0]
                                     [0, 0, 0, 8]]]

which has shape (2, 4, 4)

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
diagonal tensor of tf.dtype values

Results:

Result Description
output tensor of tf.dtype values

tf.MatrixDiagPartV3 (::mlir::TF::MatrixDiagPartV3Op)

Returns the batched diagonal part of a batched tensor.

Returns a tensor with the k[0]-th to k[1]-th diagonals of the batched input.

Assume input has r dimensions [I, J, ..., L, M, N]. Let max_diag_len be the maximum length among all diagonals to be extracted, max_diag_len = min(M + min(k[1], 0), N + min(-k[0], 0)) Let num_diags be the number of diagonals to extract, num_diags = k[1] - k[0] + 1.

If num_diags == 1, the output tensor is of rank r - 1 with shape [I, J, ..., L, max_diag_len] and values:

diagonal[i, j, ..., l, n]
  = input[i, j, ..., l, n+y, n+x] ; if 0 <= n+y < M and 0 <= n+x < N,
    padding_value                 ; otherwise.

where y = max(-k[1], 0), x = max(k[1], 0).

Otherwise, the output tensor has rank r with dimensions [I, J, ..., L, num_diags, max_diag_len] with values:

diagonal[i, j, ..., l, m, n]
  = input[i, j, ..., l, n+y, n+x] ; if 0 <= n+y < M and 0 <= n+x < N,
    padding_value                 ; otherwise.

where d = k[1] - m, y = max(-d, 0) - offset, and x = max(d, 0) - offset.

offset is zero except when the alignment of the diagonal is to the right.

offset = max_diag_len - diag_len(d) ; if (`align` in {RIGHT_LEFT, RIGHT_RIGHT}
                                           and `d >= 0`) or
                                         (`align` in {LEFT_RIGHT, RIGHT_RIGHT}
                                           and `d <= 0`)
         0                          ; otherwise

where diag_len(d) = min(cols - max(d, 0), rows + min(d, 0)).

The input must be at least a matrix.

For example:

input = np.array([[[1, 2, 3, 4],  # Input shape: (2, 3, 4)
                   [5, 6, 7, 8],
                   [9, 8, 7, 6]],
                  [[5, 4, 3, 2],
                   [1, 2, 3, 4],
                   [5, 6, 7, 8]]])

# A main diagonal from each batch.
tf.matrix_diag_part(input) ==> [[1, 6, 7],  # Output shape: (2, 3)
                                [5, 2, 7]]

# A superdiagonal from each batch.
tf.matrix_diag_part(input, k = 1)
  ==> [[2, 7, 6],  # Output shape: (2, 3)
       [4, 3, 8]]

# A band from each batch.
tf.matrix_diag_part(input, k = (-1, 2))
  ==> [[[0, 3, 8],  # Output shape: (2, 4, 3)
        [2, 7, 6],
        [1, 6, 7],
        [5, 8, 0]],
       [[0, 3, 4],
        [4, 3, 8],
        [5, 2, 7],
        [1, 6, 0]]]

# LEFT_RIGHT alignment.
tf.matrix_diag_part(input, k = (-1, 2), align="LEFT_RIGHT")
  ==> [[[3, 8, 0],  # Output shape: (2, 4, 3)
        [2, 7, 6],
        [1, 6, 7],
        [0, 5, 8]],
       [[3, 4, 0],
        [4, 3, 8],
        [5, 2, 7],
        [0, 1, 6]]]

# max_diag_len can be shorter than the main diagonal.
tf.matrix_diag_part(input, k = (-2, -1))
  ==> [[[5, 8],
        [9, 0]],
       [[1, 6],
        [5, 0]]]

# padding_value = 9
tf.matrix_diag_part(input, k = (1, 3), padding_value = 9)
  ==> [[[9, 9, 4],  # Output shape: (2, 3, 3)
        [9, 3, 8],
        [2, 7, 6]],
       [[9, 9, 2],
        [9, 3, 4],
        [4, 3, 8]]]

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
align ::mlir::StringAttr string attribute whose value is LEFT_RIGHT, or RIGHT_LEFT, or LEFT_LEFT, or RIGHT_RIGHT
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of tf.dtype values
k tensor of 32-bit integer values
padding_value tensor of tf.dtype values

Results:

Result Description
diagonal tensor of tf.dtype values

tf.MatrixDiagV2 (::mlir::TF::MatrixDiagV2Op)

Returns a batched diagonal tensor with given batched diagonal values.

Returns a tensor with the contents in diagonal as k[0]-th to k[1]-th diagonals of a matrix, with everything else padded with padding. num_rows and num_cols specify the dimension of the innermost matrix of the output. If both are not specified, the op assumes the innermost matrix is square and infers its size from k and the innermost dimension of diagonal. If only one of them is specified, the op assumes the unspecified value is the smallest possible based on other criteria.

Let diagonal have r dimensions [I, J, ..., L, M, N]. The output tensor has rank r+1 with shape [I, J, ..., L, M, num_rows, num_cols] when only one diagonal is given (k is an integer or k[0] == k[1]). Otherwise, it has rank r with shape [I, J, ..., L, num_rows, num_cols].

The second innermost dimension of diagonal has double meaning. When k is scalar or k[0] == k[1], M is part of the batch size [I, J, ..., M], and the output tensor is:

output[i, j, ..., l, m, n]
  = diagonal[i, j, ..., l, n-max(d_upper, 0)] ; if n - m == d_upper
    padding_value                             ; otherwise

Otherwise, M is treated as the number of diagonals for the matrix in the same batch (M = k[1]-k[0]+1), and the output tensor is:

output[i, j, ..., l, m, n]
  = diagonal[i, j, ..., l, diag_index, index_in_diag] ; if k[0] <= d <= k[1]
    padding_value                                     ; otherwise

where d = n - m, diag_index = k[1] - d, and index_in_diag = n - max(d, 0).

For example:

# The main diagonal.
diagonal = np.array([[1, 2, 3, 4],            # Input shape: (2, 4)
                     [5, 6, 7, 8]])
tf.matrix_diag(diagonal) ==> [[[1, 0, 0, 0],  # Output shape: (2, 4, 4)
                               [0, 2, 0, 0],
                               [0, 0, 3, 0],
                               [0, 0, 0, 4]],
                              [[5, 0, 0, 0],
                               [0, 6, 0, 0],
                               [0, 0, 7, 0],
                               [0, 0, 0, 8]]]

# A superdiagonal (per batch).
diagonal = np.array([[1, 2, 3],  # Input shape: (2, 3)
                     [4, 5, 6]])
tf.matrix_diag(diagonal, k = 1)
  ==> [[[0, 1, 0, 0],  # Output shape: (2, 4, 4)
        [0, 0, 2, 0],
        [0, 0, 0, 3],
        [0, 0, 0, 0]],
       [[0, 4, 0, 0],
        [0, 0, 5, 0],
        [0, 0, 0, 6],
        [0, 0, 0, 0]]]

# A band of diagonals.
diagonals = np.array([[[1, 2, 3],  # Input shape: (2, 2, 3)
                       [4, 5, 0]],
                      [[6, 7, 9],
                       [9, 1, 0]]])
tf.matrix_diag(diagonals, k = (-1, 0))
  ==> [[[1, 0, 0],  # Output shape: (2, 3, 3)
        [4, 2, 0],
        [0, 5, 3]],
       [[6, 0, 0],
        [9, 7, 0],
        [0, 1, 9]]]

# Rectangular matrix.
diagonal = np.array([1, 2])  # Input shape: (2)
tf.matrix_diag(diagonal, k = -1, num_rows = 3, num_cols = 4)
  ==> [[0, 0, 0, 0],  # Output shape: (3, 4)
       [1, 0, 0, 0],
       [0, 2, 0, 0]]

# Rectangular matrix with inferred num_cols and padding_value = 9.
tf.matrix_diag(diagonal, k = -1, num_rows = 3, padding_value = 9)
  ==> [[9, 9],  # Output shape: (3, 2)
       [1, 9],
       [9, 2]]

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
diagonal tensor of tf.dtype values
k tensor of 32-bit integer values
num_rows tensor of 32-bit integer values
num_cols tensor of 32-bit integer values
padding_value tensor of tf.dtype values

Results:

Result Description
output tensor of tf.dtype values

tf.MatrixDiagV3 (::mlir::TF::MatrixDiagV3Op)

Returns a batched diagonal tensor with given batched diagonal values.

Returns a tensor with the contents in diagonal as k[0]-th to k[1]-th diagonals of a matrix, with everything else padded with padding. num_rows and num_cols specify the dimension of the innermost matrix of the output. If both are not specified, the op assumes the innermost matrix is square and infers its size from k and the innermost dimension of diagonal. If only one of them is specified, the op assumes the unspecified value is the smallest possible based on other criteria.

Let diagonal have r dimensions [I, J, ..., L, M, N]. The output tensor has rank r+1 with shape [I, J, ..., L, M, num_rows, num_cols] when only one diagonal is given (k is an integer or k[0] == k[1]). Otherwise, it has rank r with shape [I, J, ..., L, num_rows, num_cols].

The second innermost dimension of diagonal has double meaning. When k is scalar or k[0] == k[1], M is part of the batch size [I, J, ..., M], and the output tensor is:

output[i, j, ..., l, m, n]
  = diagonal[i, j, ..., l, n-max(d_upper, 0)] ; if n - m == d_upper
    padding_value                             ; otherwise

Otherwise, M is treated as the number of diagonals for the matrix in the same batch (M = k[1]-k[0]+1), and the output tensor is:

output[i, j, ..., l, m, n]
  = diagonal[i, j, ..., l, diag_index, index_in_diag] ; if k[0] <= d <= k[1]
    padding_value                                     ; otherwise

where d = n - m, diag_index = [k] - d, and index_in_diag = n - max(d, 0) + offset.

offset is zero except when the alignment of the diagonal is to the right.

offset = max_diag_len - diag_len(d) ; if (`align` in {RIGHT_LEFT, RIGHT_RIGHT}
                                           and `d >= 0`) or
                                         (`align` in {LEFT_RIGHT, RIGHT_RIGHT}
                                           and `d <= 0`)
         0                          ; otherwise

where diag_len(d) = min(cols - max(d, 0), rows + min(d, 0)).

For example:

# The main diagonal.
diagonal = np.array([[1, 2, 3, 4],            # Input shape: (2, 4)
                     [5, 6, 7, 8]])
tf.matrix_diag(diagonal) ==> [[[1, 0, 0, 0],  # Output shape: (2, 4, 4)
                               [0, 2, 0, 0],
                               [0, 0, 3, 0],
                               [0, 0, 0, 4]],
                              [[5, 0, 0, 0],
                               [0, 6, 0, 0],
                               [0, 0, 7, 0],
                               [0, 0, 0, 8]]]

# A superdiagonal (per batch).
diagonal = np.array([[1, 2, 3],  # Input shape: (2, 3)
                     [4, 5, 6]])
tf.matrix_diag(diagonal, k = 1)
  ==> [[[0, 1, 0, 0],  # Output shape: (2, 4, 4)
        [0, 0, 2, 0],
        [0, 0, 0, 3],
        [0, 0, 0, 0]],
       [[0, 4, 0, 0],
        [0, 0, 5, 0],
        [0, 0, 0, 6],
        [0, 0, 0, 0]]]

# A tridiagonal band (per batch).
diagonals = np.array([[[0, 8, 9],  # Input shape: (2, 2, 3)
                       [1, 2, 3],
                       [4, 5, 0]],
                      [[0, 2, 3],
                       [6, 7, 9],
                       [9, 1, 0]]])
tf.matrix_diag(diagonals, k = (-1, 1))
  ==> [[[1, 8, 0],  # Output shape: (2, 3, 3)
        [4, 2, 9],
        [0, 5, 3]],
       [[6, 2, 0],
        [9, 7, 3],
        [0, 1, 9]]]

# LEFT_RIGHT alignment.
diagonals = np.array([[[8, 9, 0],  # Input shape: (2, 2, 3)
                       [1, 2, 3],
                       [0, 4, 5]],
                      [[2, 3, 0],
                       [6, 7, 9],
                       [0, 9, 1]]])
tf.matrix_diag(diagonals, k = (-1, 1), align="LEFT_RIGHT")
  ==> [[[1, 8, 0],  # Output shape: (2, 3, 3)
        [4, 2, 9],
        [0, 5, 3]],
       [[6, 2, 0],
        [9, 7, 3],
        [0, 1, 9]]]

# Rectangular matrix.
diagonal = np.array([1, 2])  # Input shape: (2)
tf.matrix_diag(diagonal, k = -1, num_rows = 3, num_cols = 4)
  ==> [[0, 0, 0, 0],  # Output shape: (3, 4)
       [1, 0, 0, 0],
       [0, 2, 0, 0]]

# Rectangular matrix with inferred num_cols and padding_value = 9.
tf.matrix_diag(diagonal, k = -1, num_rows = 3, padding_value = 9)
  ==> [[9, 9],  # Output shape: (3, 2)
       [1, 9],
       [9, 2]]

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
align ::mlir::StringAttr string attribute whose value is LEFT_RIGHT, or RIGHT_LEFT, or LEFT_LEFT, or RIGHT_RIGHT
T ::mlir::Attribute derived attribute

Operands:

Operand Description
diagonal tensor of tf.dtype values
k tensor of 32-bit integer values
num_rows tensor of 32-bit integer values
num_cols tensor of 32-bit integer values
padding_value tensor of tf.dtype values

Results:

Result Description
output tensor of tf.dtype values

tf.MatrixInverse (::mlir::TF::MatrixInverseOp)

Computes the inverse of one or more square invertible matrices or their adjoints (conjugate transposes).

The input is a tensor of shape [..., M, M] whose inner-most 2 dimensions form square matrices. The output is a tensor of the same shape as the input containing the inverse for all input submatrices [..., :, :].

The op uses LU decomposition with partial pivoting to compute the inverses.

If a matrix is not invertible there is no guarantee what the op does. It may detect the condition and raise an exception or it may simply return a garbage result.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
adjoint ::mlir::BoolAttr bool attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float values

Results:

Result Description
output tensor of 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float values

tf.MatrixSetDiag (::mlir::TF::MatrixSetDiagOp)

Returns a batched matrix tensor with new batched diagonal values.

Given input and diagonal, this operation returns a tensor with the same shape and values as input, except for the main diagonal of the innermost matrices. These will be overwritten by the values in diagonal.

The output is computed as follows:

Assume input has k+1 dimensions [I, J, K, ..., M, N] and diagonal has k dimensions [I, J, K, ..., min(M, N)]. Then the output is a tensor of rank k+1 with dimensions [I, J, K, ..., M, N] where:

  • output[i, j, k, ..., m, n] = diagonal[i, j, k, ..., n] for m == n.
  • output[i, j, k, ..., m, n] = input[i, j, k, ..., m, n] for m != n.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of tf.dtype values
diagonal tensor of tf.dtype values

Results:

Result Description
output tensor of tf.dtype values

tf.MatrixSetDiagV2 (::mlir::TF::MatrixSetDiagV2Op)

Returns a batched matrix tensor with new batched diagonal values.

Given input and diagonal, this operation returns a tensor with the same shape and values as input, except for the specified diagonals of the innermost matrices. These will be overwritten by the values in diagonal.

input has r+1 dimensions [I, J, ..., L, M, N]. When k is scalar or k[0] == k[1], diagonal has r dimensions [I, J, ..., L, max_diag_len]. Otherwise, it has r+1 dimensions [I, J, ..., L, num_diags, max_diag_len]. num_diags is the number of diagonals, num_diags = k[1] - k[0] + 1. max_diag_len is the longest diagonal in the range [k[0], k[1]], max_diag_len = min(M + min(k[1], 0), N + min(-k[0], 0))

The output is a tensor of rank k+1 with dimensions [I, J, ..., L, M, N]. If k is scalar or k[0] == k[1]:

output[i, j, ..., l, m, n]
  = diagonal[i, j, ..., l, n-max(k[1], 0)] ; if n - m == k[1]
    input[i, j, ..., l, m, n]              ; otherwise

Otherwise,

output[i, j, ..., l, m, n]
  = diagonal[i, j, ..., l, diag_index, index_in_diag] ; if k[0] <= d <= k[1]
    input[i, j, ..., l, m, n]                         ; otherwise

where d = n - m, diag_index = k[1] - d, and index_in_diag = n - max(d, 0).

For example:

# The main diagonal.
input = np.array([[[7, 7, 7, 7],              # Input shape: (2, 3, 4)
                   [7, 7, 7, 7],
                   [7, 7, 7, 7]],
                  [[7, 7, 7, 7],
                   [7, 7, 7, 7],
                   [7, 7, 7, 7]]])
diagonal = np.array([[1, 2, 3],               # Diagonal shape: (2, 3)
                     [4, 5, 6]])
tf.matrix_set_diag(diagonal) ==> [[[1, 7, 7, 7],  # Output shape: (2, 3, 4)
                                   [7, 2, 7, 7],
                                   [7, 7, 3, 7]],
                                  [[4, 7, 7, 7],
                                   [7, 5, 7, 7],
                                   [7, 7, 6, 7]]]

# A superdiagonal (per batch).
tf.matrix_set_diag(diagonal, k = 1)
  ==> [[[7, 1, 7, 7],  # Output shape: (2, 3, 4)
        [7, 7, 2, 7],
        [7, 7, 7, 3]],
       [[7, 4, 7, 7],
        [7, 7, 5, 7],
        [7, 7, 7, 6]]]

# A band of diagonals.
diagonals = np.array([[[1, 2, 3],  # Diagonal shape: (2, 2, 3)
                       [4, 5, 0]],
                      [[6, 1, 2],
                       [3, 4, 0]]])
tf.matrix_set_diag(diagonals, k = (-1, 0))
  ==> [[[1, 7, 7, 7],  # Output shape: (2, 3, 4)
        [4, 2, 7, 7],
        [0, 5, 3, 7]],
       [[6, 7, 7, 7],
        [3, 1, 7, 7],
        [7, 4, 2, 7]]]

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of tf.dtype values
diagonal tensor of tf.dtype values
k tensor of 32-bit integer values

Results:

Result Description
output tensor of tf.dtype values

tf.MatrixSetDiagV3 (::mlir::TF::MatrixSetDiagV3Op)

Returns a batched matrix tensor with new batched diagonal values.

Given input and diagonal, this operation returns a tensor with the same shape and values as input, except for the specified diagonals of the innermost matrices. These will be overwritten by the values in diagonal.

input has r+1 dimensions [I, J, ..., L, M, N]. When k is scalar or k[0] == k[1], diagonal has r dimensions [I, J, ..., L, max_diag_len]. Otherwise, it has r+1 dimensions [I, J, ..., L, num_diags, max_diag_len]. num_diags is the number of diagonals, num_diags = k[1] - k[0] + 1. max_diag_len is the longest diagonal in the range [k[0], k[1]], max_diag_len = min(M + min(k[1], 0), N + min(-k[0], 0))

The output is a tensor of rank k+1 with dimensions [I, J, ..., L, M, N]. If k is scalar or k[0] == k[1]:

output[i, j, ..., l, m, n]
  = diagonal[i, j, ..., l, n-max(k[1], 0)] ; if n - m == k[1]
    input[i, j, ..., l, m, n]              ; otherwise

Otherwise,

output[i, j, ..., l, m, n]
  = diagonal[i, j, ..., l, diag_index, index_in_diag] ; if k[0] <= d <= k[1]
    input[i, j, ..., l, m, n]                         ; otherwise

where d = n - m, diag_index = k[1] - d, and index_in_diag = n - max(d, 0) + offset.

offset is zero except when the alignment of the diagonal is to the right.

offset = max_diag_len - diag_len(d) ; if (`align` in {RIGHT_LEFT, RIGHT_RIGHT}
                                           and `d >= 0`) or
                                         (`align` in {LEFT_RIGHT, RIGHT_RIGHT}
                                           and `d <= 0`)
         0                          ; otherwise

where diag_len(d) = min(cols - max(d, 0), rows + min(d, 0)).

For example:

# The main diagonal.
input = np.array([[[7, 7, 7, 7],              # Input shape: (2, 3, 4)
                   [7, 7, 7, 7],
                   [7, 7, 7, 7]],
                  [[7, 7, 7, 7],
                   [7, 7, 7, 7],
                   [7, 7, 7, 7]]])
diagonal = np.array([[1, 2, 3],               # Diagonal shape: (2, 3)
                     [4, 5, 6]])
tf.matrix_set_diag(input, diagonal)
  ==> [[[1, 7, 7, 7],  # Output shape: (2, 3, 4)
        [7, 2, 7, 7],
        [7, 7, 3, 7]],
       [[4, 7, 7, 7],
        [7, 5, 7, 7],
        [7, 7, 6, 7]]]

# A superdiagonal (per batch).
tf.matrix_set_diag(input, diagonal, k = 1)
  ==> [[[7, 1, 7, 7],  # Output shape: (2, 3, 4)
        [7, 7, 2, 7],
        [7, 7, 7, 3]],
       [[7, 4, 7, 7],
        [7, 7, 5, 7],
        [7, 7, 7, 6]]]

# A band of diagonals.
diagonals = np.array([[[0, 9, 1],  # Diagonal shape: (2, 4, 3)
                       [6, 5, 8],
                       [1, 2, 3],
                       [4, 5, 0]],
                      [[0, 1, 2],
                       [5, 6, 4],
                       [6, 1, 2],
                       [3, 4, 0]]])
tf.matrix_set_diag(input, diagonals, k = (-1, 2))
  ==> [[[1, 6, 9, 7],  # Output shape: (2, 3, 4)
        [4, 2, 5, 1],
        [7, 5, 3, 8]],
       [[6, 5, 1, 7],
        [3, 1, 6, 2],
        [7, 4, 2, 4]]]

# LEFT_RIGHT alignment.
diagonals = np.array([[[9, 1, 0],  # Diagonal shape: (2, 4, 3)
                       [6, 5, 8],
                       [1, 2, 3],
                       [0, 4, 5]],
                      [[1, 2, 0],
                       [5, 6, 4],
                       [6, 1, 2],
                       [0, 3, 4]]])
tf.matrix_set_diag(input, diagonals, k = (-1, 2), align="LEFT_RIGHT")
  ==> [[[1, 6, 9, 7],  # Output shape: (2, 3, 4)
        [4, 2, 5, 1],
        [7, 5, 3, 8]],
       [[6, 5, 1, 7],
        [3, 1, 6, 2],
        [7, 4, 2, 4]]]

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
align ::mlir::StringAttr string attribute whose value is LEFT_RIGHT, or RIGHT_LEFT, or LEFT_LEFT, or RIGHT_RIGHT
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of tf.dtype values
diagonal tensor of tf.dtype values
k tensor of 32-bit integer values

Results:

Result Description
output tensor of tf.dtype values

tf.MatrixSolve (::mlir::TF::MatrixSolveOp)

Solves systems of linear equations.

Matrix is a tensor of shape [..., M, M] whose inner-most 2 dimensions form square matrices. Rhs is a tensor of shape [..., M, K]. The output is a tensor shape [..., M, K]. If adjoint is False then each output matrix satisfies matrix[..., :, :] * output[..., :, :] = rhs[..., :, :]. If adjoint is True then each output matrix satisfies adjoint(matrix[..., :, :]) * output[..., :, :] = rhs[..., :, :].

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
adjoint ::mlir::BoolAttr bool attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
matrix tensor of 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float values
rhs tensor of 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float values

Results:

Result Description
output tensor of 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float values

tf.MatrixTriangularSolve (::mlir::TF::MatrixTriangularSolveOp)

Solves systems of linear equations with upper or lower triangular matrices by backsubstitution.

matrix is a tensor of shape [..., M, M] whose inner-most 2 dimensions form square matrices. If lower is True then the strictly upper triangular part of each inner-most matrix is assumed to be zero and not accessed. If lower is False then the strictly lower triangular part of each inner-most matrix is assumed to be zero and not accessed. rhs is a tensor of shape [..., M, N].

The output is a tensor of shape [..., M, N]. If adjoint is True then the innermost matrices in output satisfy matrix equations matrix[..., :, :] * output[..., :, :] = rhs[..., :, :]. If adjoint is False then the strictly then the innermost matrices in output satisfy matrix equations adjoint(matrix[..., i, k]) * output[..., k, j] = rhs[..., i, j].

Note, the batch shapes for the inputs only need to broadcast.

Example:


a = tf.constant([[3,  0,  0,  0],
                 [2,  1,  0,  0],
                 [1,  0,  1,  0],
                 [1,  1,  1,  1]], dtype=tf.float32)

b = tf.constant([[4],
                 [2],
                 [4],
                 [2]], dtype=tf.float32)

x = tf.linalg.triangular_solve(a, b, lower=True)
x
# <tf.Tensor: shape=(4, 1), dtype=float32, numpy=
# array([[ 1.3333334 ],
#        [-0.66666675],
#        [ 2.6666665 ],
#        [-1.3333331 ]], dtype=float32)>

# in python3 one can use `a@x`
tf.matmul(a, x)
# <tf.Tensor: shape=(4, 1), dtype=float32, numpy=
# array([[4.       ],
#        [2.       ],
#        [4.       ],
#        [1.9999999]], dtype=float32)>

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
lower ::mlir::BoolAttr bool attribute
adjoint ::mlir::BoolAttr bool attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
matrix tensor of floating-point or complex values
rhs tensor of floating-point or complex values

Results:

Result Description
output tensor of floating-point or complex values

tf.Max (::mlir::TF::MaxOp)

Computes the maximum of elements across dimensions of a tensor.

Reduces input along the dimensions given in axis. Unless keep_dims is true, the rank of the tensor is reduced by 1 for each entry in axis. If keep_dims is true, the reduced dimensions are retained with length 1.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
keep_dims ::mlir::BoolAttr bool attribute
T ::mlir::Attribute derived attribute
Tidx ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of bfloat16 or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 16-bit quantized integer or 32-bit quantized integer or 8-bit quantized integer or 16-bit quantized unsigned integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values
reduction_indices tensor of 32/64-bit signed integer values

Results:

Result Description
output tensor of bfloat16 or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 16-bit quantized integer or 32-bit quantized integer or 8-bit quantized integer or 16-bit quantized unsigned integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

tf.MaxPool3DGradGrad (::mlir::TF::MaxPool3DGradGradOp)

Computes second-order gradients of the maxpooling function.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
ksize ::mlir::ArrayAttr 64-bit integer array attribute with at least 5 elements
strides ::mlir::ArrayAttr 64-bit integer array attribute with at least 5 elements
padding ::mlir::StringAttr string attribute whose value is SAME, or VALID
data_format ::mlir::StringAttr string attribute whose value is NDHWC, or NCDHW
T ::mlir::Attribute derived attribute

Operands:

Operand Description
orig_input tensor of integer or floating-point values
orig_output tensor of integer or floating-point values
grad tensor of integer or floating-point values

Results:

Result Description
output tensor of integer or floating-point values

tf.MaxPool3DGrad (::mlir::TF::MaxPool3DGradOp)

Computes gradients of 3D max pooling function.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
ksize ::mlir::ArrayAttr 64-bit integer array attribute with at least 5 elements
strides ::mlir::ArrayAttr 64-bit integer array attribute with at least 5 elements
padding ::mlir::StringAttr string attribute whose value is SAME, or VALID
data_format ::mlir::StringAttr string attribute whose value is NDHWC, or NCDHW
T ::mlir::Attribute derived attribute
TInput ::mlir::Attribute derived attribute

Operands:

Operand Description
orig_input tensor of bfloat16 or 16-bit float or 32-bit float values
orig_output tensor of bfloat16 or 16-bit float or 32-bit float values
grad tensor of bfloat16 or 16-bit float or 32-bit float values

Results:

Result Description
output tensor of bfloat16 or 16-bit float or 32-bit float values

tf.MaxPool3D (::mlir::TF::MaxPool3DOp)

Performs 3D max pooling on the input.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
ksize ::mlir::ArrayAttr 64-bit integer array attribute with at least 5 elements
strides ::mlir::ArrayAttr 64-bit integer array attribute with at least 5 elements
padding ::mlir::StringAttr string attribute whose value is SAME, or VALID
data_format ::mlir::StringAttr string attribute whose value is NDHWC, or NCDHW
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of bfloat16 or 16-bit float or 32-bit float values

Results:

Result Description
output tensor of bfloat16 or 16-bit float or 32-bit float values

tf.MaxPoolGradGrad (::mlir::TF::MaxPoolGradGradOp)

Computes second-order gradients of the maxpooling function.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
ksize ::mlir::ArrayAttr 64-bit integer array attribute with at least 4 elements
strides ::mlir::ArrayAttr 64-bit integer array attribute with at least 4 elements
padding ::mlir::StringAttr string attribute whose value is SAME, or VALID
data_format ::mlir::StringAttr 'NHWC' or 'NCHW' convnet data format
T ::mlir::Attribute derived attribute

Operands:

Operand Description
orig_input tensor of integer or floating-point values
orig_output tensor of integer or floating-point values
grad tensor of integer or floating-point values

Results:

Result Description
output tensor of integer or floating-point values

tf.MaxPoolGradGradV2 (::mlir::TF::MaxPoolGradGradV2Op)

Computes second-order gradients of the maxpooling function.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
padding ::mlir::StringAttr string attribute whose value is SAME, or VALID
data_format ::mlir::StringAttr 'NHWC' or 'NCHW' convnet data format
T ::mlir::Attribute derived attribute

Operands:

Operand Description
orig_input tensor of integer or floating-point values
orig_output tensor of integer or floating-point values
grad tensor of integer or floating-point values
ksize tensor of 32-bit integer values
strides tensor of 32-bit integer values

Results:

Result Description
output tensor of integer or floating-point values

tf.MaxPoolGrad (::mlir::TF::MaxPoolGradOp)

Computes gradients of the maxpooling function.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
ksize ::mlir::ArrayAttr 64-bit integer array attribute with at least 4 elements
strides ::mlir::ArrayAttr 64-bit integer array attribute with at least 4 elements
padding ::mlir::StringAttr string attribute whose value is SAME, or VALID, or EXPLICIT
explicit_paddings ::mlir::ArrayAttr 64-bit integer array attribute
data_format ::mlir::StringAttr 'NHWC' or 'NCHW' convnet data format
T ::mlir::Attribute derived attribute

Operands:

Operand Description
orig_input tensor of integer or floating-point values
orig_output tensor of integer or floating-point values
grad tensor of integer or floating-point values

Results:

Result Description
output tensor of integer or floating-point values

tf.MaxPoolGradV2 (::mlir::TF::MaxPoolGradV2Op)

Computes gradients of the maxpooling function.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
padding ::mlir::StringAttr string attribute whose value is SAME, or VALID
data_format ::mlir::StringAttr 'NHWC' or 'NCHW' convnet data format
T ::mlir::Attribute derived attribute

Operands:

Operand Description
orig_input tensor of integer or floating-point values
orig_output tensor of integer or floating-point values
grad tensor of integer or floating-point values
ksize tensor of 32-bit integer values
strides tensor of 32-bit integer values

Results:

Result Description
output tensor of integer or floating-point values

tf.MaxPool (::mlir::TF::MaxPoolOp)

Performs max pooling on the input.

Interfaces: NoSideEffect (MemoryEffectOpInterface), TF_FoldOperandsTransposeInterface, TF_LayoutSensitiveInterface

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
ksize ::mlir::ArrayAttr 64-bit integer array attribute with at least 4 elements
strides ::mlir::ArrayAttr 64-bit integer array attribute with at least 4 elements
padding ::mlir::StringAttr string attribute whose value is SAME, or VALID, or EXPLICIT
explicit_paddings ::mlir::ArrayAttr 64-bit integer array attribute
data_format ::mlir::StringAttr string attribute whose value is NHWC, or NCHW, or NCHW_VECT_C
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of bfloat16 or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 8-bit quantized integer or 16-bit unsigned integer or 8-bit unsigned integer values

Results:

Result Description
output tensor of bfloat16 or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 8-bit quantized integer or 16-bit unsigned integer or 8-bit unsigned integer values

tf.MaxPoolV2 (::mlir::TF::MaxPoolV2Op)

Performs max pooling on the input.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
padding ::mlir::StringAttr string attribute whose value is SAME, or VALID
data_format ::mlir::StringAttr string attribute whose value is NHWC, or NCHW, or NCHW_VECT_C
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of bfloat16 or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 8-bit quantized integer or 16-bit unsigned integer or 8-bit unsigned integer values
ksize tensor of 32-bit integer values
strides tensor of 32-bit integer values

Results:

Result Description
output tensor of bfloat16 or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 8-bit quantized integer or 16-bit unsigned integer or 8-bit unsigned integer values

tf.Maximum (::mlir::TF::MaximumOp)

Returns the max of x and y (i.e. x > y ? x : y) element-wise.

Traits: ResultsBroadcastableShape, TF_SameOperandsAndResultElementTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of integer or floating-point values
y tensor of integer or floating-point values

Results:

Result Description
z tensor of integer or floating-point values

tf.Mean (::mlir::TF::MeanOp)

Computes the mean of elements across dimensions of a tensor.

Reduces input along the dimensions given in axis. Unless keep_dims is true, the rank of the tensor is reduced by 1 for each entry in axis. If keep_dims is true, the reduced dimensions are retained with length 1.

Interfaces: NoSideEffect (MemoryEffectOpInterface), TF_FoldOperandsTransposeInterface

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
keep_dims ::mlir::BoolAttr bool attribute
T ::mlir::Attribute derived attribute
Tidx ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values
reduction_indices tensor of 32/64-bit signed integer values

Results:

Result Description
output tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

tf.MergeSummary (::mlir::TF::MergeSummaryOp)

Merges summaries.

This op creates a Summary protocol buffer that contains the union of all the values in the input summaries.

When the Op is run, it reports an InvalidArgument error if multiple values in the summaries to merge use the same tag.

Traits: SameOperandsAndResultType

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
N ::mlir::Attribute derived attribute

Operands:

Operand Description
inputs tensor of string values

Results:

Result Description
summary tensor of string values

tf.MergeV2Checkpoints (::mlir::TF::MergeV2CheckpointsOp)

V2 format specific: merges the metadata files of sharded checkpoints. The

result is one logical checkpoint, with one physical metadata file and renamed data files.

Intended for "grouping" multiple checkpoints in a sharded checkpoint setup.

If delete_old_dirs is true, attempts to delete recursively the dirname of each path in the input checkpoint_prefixes. This is useful when those paths are non user-facing temporary locations.

Attributes:

Attribute MLIR Type Description
delete_old_dirs ::mlir::BoolAttr bool attribute

Operands:

Operand Description
checkpoint_prefixes tensor of string values
destination_prefix tensor of string values

tf.Min (::mlir::TF::MinOp)

Computes the minimum of elements across dimensions of a tensor.

Reduces input along the dimensions given in axis. Unless keep_dims is true, the rank of the tensor is reduced by 1 for each entry in axis. If keep_dims is true, the reduced dimensions are retained with length 1.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
keep_dims ::mlir::BoolAttr bool attribute
T ::mlir::Attribute derived attribute
Tidx ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of bfloat16 or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 16-bit quantized integer or 32-bit quantized integer or 8-bit quantized integer or 16-bit quantized unsigned integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values
reduction_indices tensor of 32/64-bit signed integer values

Results:

Result Description
output tensor of bfloat16 or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 16-bit quantized integer or 32-bit quantized integer or 8-bit quantized integer or 16-bit quantized unsigned integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

tf.Minimum (::mlir::TF::MinimumOp)

Returns the min of x and y (i.e. x < y ? x : y) element-wise.

Traits: ResultsBroadcastableShape, TF_SameOperandsAndResultElementTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of integer or floating-point values
y tensor of integer or floating-point values

Results:

Result Description
z tensor of integer or floating-point values

tf.MirrorPadGrad (::mlir::TF::MirrorPadGradOp)

Gradient op for MirrorPad op. This op folds a mirror-padded tensor.

This operation folds the padded areas of input by MirrorPad according to the paddings you specify. paddings must be the same as paddings argument given to the corresponding MirrorPad op.

The folded size of each dimension D of the output is:

input.dim_size(D) - paddings(D, 0) - paddings(D, 1)

For example:

# 't' is [[1, 2, 3], [4, 5, 6], [7, 8, 9]].
# 'paddings' is [[0, 1]], [0, 1]].
# 'mode' is SYMMETRIC.
# rank of 't' is 2.
pad(t, paddings) ==> [[ 1,  5]
                      [11, 28]]

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
mode ::mlir::StringAttr string attribute whose value is REFLECT, or SYMMETRIC
T ::mlir::Attribute derived attribute
Tpaddings ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of tf.dtype values
paddings tensor of 32/64-bit signed integer values

Results:

Result Description
output tensor of tf.dtype values

tf.MirrorPad (::mlir::TF::MirrorPadOp)

Pads a tensor with mirrored values.

This operation pads a input with mirrored values according to the paddings you specify. paddings is an integer tensor with shape [n, 2], where n is the rank of input. For each dimension D of input, paddings[D, 0] indicates how many values to add before the contents of input in that dimension, and paddings[D, 1] indicates how many values to add after the contents of input in that dimension. Both paddings[D, 0] and paddings[D, 1] must be no greater than input.dim_size(D) (or input.dim_size(D) - 1) if copy_border is true (if false, respectively).

The padded size of each dimension D of the output is:

paddings(D, 0) + input.dim_size(D) + paddings(D, 1)

For example:

# 't' is [[1, 2, 3], [4, 5, 6]].
# 'paddings' is [[1, 1]], [2, 2]].
# 'mode' is SYMMETRIC.
# rank of 't' is 2.
pad(t, paddings) ==> [[2, 1, 1, 2, 3, 3, 2]
                      [2, 1, 1, 2, 3, 3, 2]
                      [5, 4, 4, 5, 6, 6, 5]
                      [5, 4, 4, 5, 6, 6, 5]]

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
mode ::mlir::StringAttr string attribute whose value is REFLECT, or SYMMETRIC
T ::mlir::Attribute derived attribute
Tpaddings ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of tf.dtype values
paddings tensor of 32/64-bit signed integer values

Results:

Result Description
output tensor of tf.dtype values

tf.MlirLocalVarOp (::mlir::TF::MlirLocalVarOp)

Creates a handle to an in-scope variable.

Used by internal passes for temporary representation of local state, which will be eventually removed.

Results:

Result Description
resource tensor of resource values

tf.MlirPassthroughOp (::mlir::TF::MlirPassthroughOp)

Wraps an arbitrary MLIR computation expressed as a module with a main() function.

This operation does not have an associated kernel and is not intended to be executed in a regular TensorFlow session. Instead it is intended to be used for testing or for special case where a user intends to pass custom MLIR computation through a TensorFlow graph with the intent of having custom tooling processing it downstream (when targeting a different environment, like TensorFlow lite for example). The MLIR module is expected to have a main() function that will be used as an entry point. The inputs to the operations will be passed as argument to the main() function and the returned values of the main function mapped to the outputs. Example usage:

import tensorflow as tf
from tensorflow.compiler.mlir.tensorflow.gen_mlir_passthrough_op import mlir_passthrough_op

mlir_module = '''python
func @main(%arg0 : tensor<10xf32>, %arg1 : tensor<10xf32>) -> tensor<10x10xf32> {
   %add = "magic.op"(%arg0, %arg1) : (tensor<10xf32>, tensor<10xf32>) -> tensor<10x10xf32>
   return %ret : tensor<10x10xf32>
}
'''

@tf.function
def foo(x, y):
  return mlir_passthrough_op([x, y], mlir_module, Toutputs=[tf.float32])

graph_def = foo.get_concrete_function(tf.TensorSpec([10], tf.float32), tf.TensorSpec([10], tf.float32)).graph.as_graph_def()

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
mlir_module ::mlir::StringAttr string attribute
Tinputs ::mlir::Attribute derived attribute
Toutputs ::mlir::Attribute derived attribute

Operands:

Operand Description
inputs tensor of tf.dtype values

Results:

Result Description
outputs tensor of tf.dtype values

tf.Mod (::mlir::TF::ModOp)

Returns element-wise remainder of division. This emulates C semantics in that

the result here is consistent with a truncating divide. E.g. tf.truncatediv(x, y) * y + truncate_mod(x, y) = x.

Traits: ResultsBroadcastableShape, TF_SameOperandsAndResultElementTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of floating-point or 32/64-bit signed integer values
y tensor of floating-point or 32/64-bit signed integer values

Results:

Result Description
z tensor of floating-point or 32/64-bit signed integer values

tf.ModelDataset (::mlir::TF::ModelDatasetOp)

Identity transformation that models performance.

Identity transformation that models performance.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
algorithm ::mlir::IntegerAttr 64-bit signless integer attribute
cpu_budget ::mlir::IntegerAttr 64-bit signless integer attribute
ram_budget ::mlir::IntegerAttr 64-bit signless integer attribute
output_types ::mlir::ArrayAttr type array attribute with at least 1 elements
output_shapes ::mlir::ArrayAttr tensorflow shape attribute array with at least 1 elements

Operands:

Operand Description
input_dataset tensor of variant values

Results:

Result Description
handle tensor of variant values

tf.MulNoNan (::mlir::TF::MulNoNanOp)

Returns x * y element-wise. Returns zero if y is zero, even if x if infinite or NaN.

Traits: ResultsBroadcastableShape

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of floating-point or complex values
y tensor of floating-point or complex values

Results:

Result Description
z tensor of floating-point or complex values

tf.Mul (::mlir::TF::MulOp)

Returns x * y element-wise.

Traits: Commutative, ResultsBroadcastableShape, TF_CwiseBinary, TF_SameOperandsAndResultElementTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values
y tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

Results:

Result Description
z tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

tf.MultiDeviceIteratorFromStringHandle (::mlir::TF::MultiDeviceIteratorFromStringHandleOp)

Generates a MultiDeviceIterator resource from its provided string handle.

Attributes:

Attribute MLIR Type Description
output_types ::mlir::ArrayAttr type array attribute
output_shapes ::mlir::ArrayAttr tensorflow shape attribute array

Operands:

Operand Description
string_handle tensor of string values

Results:

Result Description
multi_device_iterator tensor of resource values

tf.MultiDeviceIteratorGetNextFromShard (::mlir::TF::MultiDeviceIteratorGetNextFromShardOp)

Gets next element for the provided shard number.

Attributes:

Attribute MLIR Type Description
output_shapes ::mlir::Attribute derived attribute
output_types ::mlir::Attribute derived attribute

Operands:

Operand Description
multi_device_iterator tensor of resource values
shard_num tensor of 32-bit integer values
incarnation_id tensor of 64-bit integer values

Results:

Result Description
components tensor of tf.dtype values

tf.MultiDeviceIteratorInit (::mlir::TF::MultiDeviceIteratorInitOp)

Initializes the multi device iterator with the given dataset.

Operands:

Operand Description
dataset tensor of variant values
multi_device_iterator tensor of resource values
max_buffer_size tensor of 64-bit integer values

Results:

Result Description
incarnation_id tensor of 64-bit integer values

tf.MultiDeviceIterator (::mlir::TF::MultiDeviceIteratorOp)

Creates a MultiDeviceIterator resource.

Attributes:

Attribute MLIR Type Description
devices ::mlir::ArrayAttr string array attribute with at least 1 elements
shared_name ::mlir::StringAttr string attribute
container ::mlir::StringAttr string attribute
output_types ::mlir::ArrayAttr type array attribute with at least 1 elements
output_shapes ::mlir::ArrayAttr tensorflow shape attribute array with at least 1 elements

Results:

Result Description
handle tensor of resource values

tf.MultiDeviceIteratorToStringHandle (::mlir::TF::MultiDeviceIteratorToStringHandleOp)

Produces a string handle for the given MultiDeviceIterator.

Operands:

Operand Description
multi_device_iterator tensor of resource values

Results:

Result Description
string_handle tensor of string values

tf.Multinomial (::mlir::TF::MultinomialOp)

Draws samples from a multinomial distribution.

Traits: TF_CannotDuplicate

Attributes:

Attribute MLIR Type Description
seed ::mlir::IntegerAttr 64-bit signless integer attribute
seed2 ::mlir::IntegerAttr 64-bit signless integer attribute
T ::mlir::Attribute derived attribute
output_dtype ::mlir::Attribute derived attribute

Operands:

Operand Description
logits tensor of integer or floating-point values
num_samples tensor of 32-bit integer values

Results:

Result Description
output tensor of 32/64-bit signed integer values

tf.MutableDenseHashTableV2 (::mlir::TF::MutableDenseHashTableV2Op)

Creates an empty hash table that uses tensors as the backing store.

It uses "open addressing" with quadratic reprobing to resolve collisions.

This op creates a mutable hash table, specifying the type of its keys and values. Each value must be a scalar. Data can be inserted into the table using the insert operations. It does not support the initialization operation.

Attributes:

Attribute MLIR Type Description
container ::mlir::StringAttr string attribute
shared_name ::mlir::StringAttr string attribute
use_node_name_sharing ::mlir::BoolAttr bool attribute
value_dtype ::mlir::TypeAttr any type attribute
value_shape ::mlir::Attribute TensorFlow shape attribute
initial_num_buckets ::mlir::IntegerAttr 64-bit signless integer attribute
max_load_factor ::mlir::FloatAttr 32-bit float attribute
key_dtype ::mlir::Attribute derived attribute

Operands:

Operand Description
empty_key tensor of tf.dtype values
deleted_key tensor of tf.dtype values

Results:

Result Description
table_handle tensor of resource values

tf.MutableHashTableOfTensorsV2 (::mlir::TF::MutableHashTableOfTensorsV2Op)

Creates an empty hash table.

This op creates a mutable hash table, specifying the type of its keys and values. Each value must be a vector. Data can be inserted into the table using the insert operations. It does not support the initialization operation.

Attributes:

Attribute MLIR Type Description
container ::mlir::StringAttr string attribute
shared_name ::mlir::StringAttr string attribute
use_node_name_sharing ::mlir::BoolAttr bool attribute
key_dtype ::mlir::TypeAttr any type attribute
value_dtype ::mlir::TypeAttr any type attribute
value_shape ::mlir::Attribute TensorFlow shape attribute

Results:

Result Description
table_handle tensor of resource values

tf.MutableHashTableV2 (::mlir::TF::MutableHashTableV2Op)

Creates an empty hash table.

This op creates a mutable hash table, specifying the type of its keys and values. Each value must be a scalar. Data can be inserted into the table using the insert operations. It does not support the initialization operation.

Attributes:

Attribute MLIR Type Description
container ::mlir::StringAttr string attribute
shared_name ::mlir::StringAttr string attribute
use_node_name_sharing ::mlir::BoolAttr bool attribute
key_dtype ::mlir::TypeAttr any type attribute
value_dtype ::mlir::TypeAttr any type attribute

Results:

Result Description
table_handle tensor of resource values

tf.Ndtri (::mlir::TF::NdtriOp)

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of floating-point values

Results:

Result Description
y tensor of floating-point values

tf.Neg (::mlir::TF::NegOp)

Computes numerical negative value element-wise.

I.e., \(y = -x\).

Traits: Involution, SameOperandsAndResultType, TF_CwiseUnary

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer values

Results:

Result Description
y tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer values

tf.NextAfter (::mlir::TF::NextAfterOp)

Returns the next representable value of x1 in the direction of x2, element-wise.

This operation returns the same result as the C++ std::nextafter function.

It can also return a subnormal number.

@compatibility(cpp) Equivalent to C++ std::nextafter function. @end_compatibility

Traits: ResultsBroadcastableShape

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x1 tensor of 32/64-bit float values
x2 tensor of 32/64-bit float values

Results:

Result Description
output tensor of 32/64-bit float values

tf.NoOp (::mlir::TF::NoOp)

Does nothing. Only useful as a placeholder for control edges.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

tf.NonMaxSuppressionV3 (::mlir::TF::NonMaxSuppressionV3Op)

Greedily selects a subset of bounding boxes in descending order of score,

pruning away boxes that have high intersection-over-union (IOU) overlap with previously selected boxes. Bounding boxes with score less than score_threshold are removed. Bounding boxes are supplied as [y1, x1, y2, x2], where (y1, x1) and (y2, x2) are the coordinates of any diagonal pair of box corners and the coordinates can be provided as normalized (i.e., lying in the interval [0, 1]) or absolute. Note that this algorithm is agnostic to where the origin is in the coordinate system and more generally is invariant to orthogonal transformations and translations of the coordinate system; thus translating or reflections of the coordinate system result in the same boxes being selected by the algorithm. The output of this operation is a set of integers indexing into the input collection of bounding boxes representing the selected boxes. The bounding box coordinates corresponding to the selected indices can then be obtained using the tf.gather operation. For example: selected_indices = tf.image.non_max_suppression_v2( boxes, scores, max_output_size, iou_threshold, score_threshold) selected_boxes = tf.gather(boxes, selected_indices)

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute
T_threshold ::mlir::Attribute derived attribute

Operands:

Operand Description
boxes tensor of 16-bit float or 32-bit float values
scores tensor of 16-bit float or 32-bit float values
max_output_size tensor of 32-bit integer values
iou_threshold tensor of 16-bit float or 32-bit float values
score_threshold tensor of 16-bit float or 32-bit float values

Results:

Result Description
selected_indices tensor of 32-bit integer values

tf.NonMaxSuppressionV4 (::mlir::TF::NonMaxSuppressionV4Op)

Greedily selects a subset of bounding boxes in descending order of score,

pruning away boxes that have high intersection-over-union (IOU) overlap with previously selected boxes. Bounding boxes with score less than score_threshold are removed. Bounding boxes are supplied as [y1, x1, y2, x2], where (y1, x1) and (y2, x2) are the coordinates of any diagonal pair of box corners and the coordinates can be provided as normalized (i.e., lying in the interval [0, 1]) or absolute. Note that this algorithm is agnostic to where the origin is in the coordinate system and more generally is invariant to orthogonal transformations and translations of the coordinate system; thus translating or reflections of the coordinate system result in the same boxes being selected by the algorithm. The output of this operation is a set of integers indexing into the input collection of bounding boxes representing the selected boxes. The bounding box coordinates corresponding to the selected indices can then be obtained using the tf.gather operation. For example: selected_indices = tf.image.non_max_suppression_v2( boxes, scores, max_output_size, iou_threshold, score_threshold) selected_boxes = tf.gather(boxes, selected_indices)

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
pad_to_max_output_size ::mlir::BoolAttr bool attribute
T ::mlir::Attribute derived attribute
T_threshold ::mlir::Attribute derived attribute

Operands:

Operand Description
boxes tensor of 16-bit float or 32-bit float values
scores tensor of 16-bit float or 32-bit float values
max_output_size tensor of 32-bit integer values
iou_threshold tensor of 16-bit float or 32-bit float values
score_threshold tensor of 16-bit float or 32-bit float values

Results:

Result Description
selected_indices tensor of 32-bit integer values
valid_outputs tensor of 32-bit integer values

tf.NonMaxSuppressionV5 (::mlir::TF::NonMaxSuppressionV5Op)

Greedily selects a subset of bounding boxes in descending order of score,

pruning away boxes that have high intersection-over-union (IOU) overlap with previously selected boxes. Bounding boxes with score less than score_threshold are removed. Bounding boxes are supplied as [y1, x1, y2, x2], where (y1, x1) and (y2, x2) are the coordinates of any diagonal pair of box corners and the coordinates can be provided as normalized (i.e., lying in the interval [0, 1]) or absolute. Note that this algorithm is agnostic to where the origin is in the coordinate system and more generally is invariant to orthogonal transformations and translations of the coordinate system; thus translating or reflections of the coordinate system result in the same boxes being selected by the algorithm. The output of this operation is a set of integers indexing into the input collection of bounding boxes representing the selected boxes. The bounding box coordinates corresponding to the selected indices can then be obtained using the tf.gather operation. For example: selected_indices = tf.image.non_max_suppression_v2( boxes, scores, max_output_size, iou_threshold, score_threshold) selected_boxes = tf.gather(boxes, selected_indices) This op also supports a Soft-NMS (with Gaussian weighting) mode (c.f. Bodla et al, https://arxiv.org/abs/1704.04503) where boxes reduce the score of other overlapping boxes instead of directly causing them to be pruned. To enable this Soft-NMS mode, set the soft_nms_sigma parameter to be larger than 0.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
pad_to_max_output_size ::mlir::BoolAttr bool attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
boxes tensor of 16-bit float or 32-bit float values
scores tensor of 16-bit float or 32-bit float values
max_output_size tensor of 32-bit integer values
iou_threshold tensor of 16-bit float or 32-bit float values
score_threshold tensor of 16-bit float or 32-bit float values
soft_nms_sigma tensor of 16-bit float or 32-bit float values

Results:

Result Description
selected_indices tensor of 32-bit integer values
selected_scores tensor of 16-bit float or 32-bit float values
valid_outputs tensor of 32-bit integer values

tf.NotEqual (::mlir::TF::NotEqualOp)

Returns the truth value of (x != y) element-wise.

Traits: Commutative

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
incompatible_shape_error ::mlir::BoolAttr bool attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of tf.dtype values
y tensor of tf.dtype values

Results:

Result Description
z tensor of bool values

tf.OneHot (::mlir::TF::OneHotOp)

Returns a one-hot tensor.

The locations represented by indices in indices take value on_value, while all other locations take value off_value.

If the input indices is rank N, the output will have rank N+1, The new axis is created at dimension axis (default: the new axis is appended at the end).

If indices is a scalar the output shape will be a vector of length depth.

If indices is a vector of length features, the output shape will be:

  features x depth if axis == -1
  depth x features if axis == 0

If indices is a matrix (batch) with shape [batch, features], the output shape will be:

  batch x features x depth if axis == -1
  batch x depth x features if axis == 1
  depth x batch x features if axis == 0

Examples

Suppose that

  indices = [0, 2, -1, 1]
  depth = 3
  on_value = 5.0
  off_value = 0.0
  axis = -1

Then output is [4 x 3]:

output =
  [5.0 0.0 0.0]  // one_hot(0)
  [0.0 0.0 5.0]  // one_hot(2)
  [0.0 0.0 0.0]  // one_hot(-1)
  [0.0 5.0 0.0]  // one_hot(1)

Suppose that

  indices = [0, 2, -1, 1]
  depth = 3
  on_value = 0.0
  off_value = 3.0
  axis = 0

Then output is [3 x 4]:

output =
  [0.0 3.0 3.0 3.0]
  [3.0 3.0 3.0 0.0]
  [3.0 3.0 3.0 3.0]
  [3.0 0.0 3.0 3.0]
//  ^                one_hot(0)
//      ^            one_hot(2)
//          ^        one_hot(-1)
//              ^    one_hot(1)

Suppose that

  indices = [[0, 2], [1, -1]]
  depth = 3
  on_value = 1.0
  off_value = 0.0
  axis = -1

Then output is [2 x 2 x 3]:

output =
  [
    [1.0, 0.0, 0.0]  // one_hot(0)
    [0.0, 0.0, 1.0]  // one_hot(2)
  ][
    [0.0, 1.0, 0.0]  // one_hot(1)
    [0.0, 0.0, 0.0]  // one_hot(-1)
  ]

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
axis ::mlir::IntegerAttr 64-bit signless integer attribute
T ::mlir::Attribute derived attribute
TI ::mlir::Attribute derived attribute

Operands:

Operand Description
indices tensor of 32-bit integer or 64-bit integer or 8-bit unsigned integer values
depth tensor of 32-bit integer values
on_value tensor of tf.dtype values
off_value tensor of tf.dtype values

Results:

Result Description
output tensor of tf.dtype values

tf.OneShotIterator (::mlir::TF::OneShotIteratorOp)

Makes a "one-shot" iterator that can be iterated only once.

A one-shot iterator bundles the logic for defining the dataset and the state of the iterator in a single op, which allows simple input pipelines to be defined without an additional initialization ("MakeIterator") step.

One-shot iterators have the following limitations:

  • They do not support parameterization: all logic for creating the underlying dataset must be bundled in the dataset_factory function.
  • They are not resettable. Once a one-shot iterator reaches the end of its underlying dataset, subsequent "IteratorGetNext" operations on that iterator will always produce an OutOfRange error.

For greater flexibility, use "Iterator" and "MakeIterator" to define an iterator using an arbitrary subgraph, which may capture tensors (including fed values) as parameters, and which may be reset multiple times by rerunning "MakeIterator".

Attributes:

Attribute MLIR Type Description
dataset_factory ::mlir::SymbolRefAttr symbol reference attribute
output_types ::mlir::ArrayAttr type array attribute with at least 1 elements
output_shapes ::mlir::ArrayAttr tensorflow shape attribute array with at least 1 elements
container ::mlir::StringAttr string attribute
shared_name ::mlir::StringAttr string attribute

Results:

Result Description
handle tensor of resource values

tf.OnesLike (::mlir::TF::OnesLikeOp)

Returns a tensor of ones with the same shape and type as x.

Traits: Idempotent, SameOperandsAndResultType

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of bfloat16 or bool or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

Results:

Result Description
y tensor of bfloat16 or bool or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

tf.OptimizeDatasetV2 (::mlir::TF::OptimizeDatasetV2Op)

Creates a dataset by applying related optimizations to input_dataset.

Creates a dataset by applying related optimizations to input_dataset.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
output_types ::mlir::ArrayAttr type array attribute with at least 1 elements
output_shapes ::mlir::ArrayAttr tensorflow shape attribute array with at least 1 elements
optimization_configs ::mlir::ArrayAttr string array attribute

Operands:

Operand Description
input_dataset tensor of variant values
optimizations_enabled tensor of string values
optimizations_disabled tensor of string values
optimizations_default tensor of string values

Results:

Result Description
handle tensor of variant values

tf.OptionalFromValue (::mlir::TF::OptionalFromValueOp)

Constructs an Optional variant from a tuple of tensors.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
Toutput_types ::mlir::Attribute derived attribute

Operands:

Operand Description
components tensor of tf.dtype values

Results:

Result Description
optional tensor of variant values

tf.OptionalGetValue (::mlir::TF::OptionalGetValueOp)

Returns the value stored in an Optional variant or raises an error if none exists.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
output_shapes ::mlir::Attribute derived attribute
output_types ::mlir::Attribute derived attribute

Operands:

Operand Description
optional tensor of variant values

Results:

Result Description
components tensor of tf.dtype values

tf.OptionalHasValue (::mlir::TF::OptionalHasValueOp)

Returns true if and only if the given Optional variant has a value.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

Operand Description
optional tensor of variant values

Results:

Result Description
has_value tensor of bool values

tf.OptionalNone (::mlir::TF::OptionalNoneOp)

Creates an Optional variant with no value.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Results:

Result Description
optional tensor of variant values

tf.OutfeedEnqueueTuple (::mlir::TF::OutfeedEnqueueTupleOp)

Enqueue multiple Tensor values on the computation outfeed.

Attributes:

Attribute MLIR Type Description
dtypes ::mlir::Attribute derived attribute

Operands:

Operand Description
inputs tensor of tf.dtype values

tf.Pack (::mlir::TF::PackOp)

Packs a list of N rank-R tensors into one rank-(R+1) tensor.

Packs the N tensors in values into a tensor with rank one higher than each tensor in values, by packing them along the axis dimension. Given a list of tensors of shape (A, B, C);

if axis == 0 then the output tensor will have the shape (N, A, B, C). if axis == 1 then the output tensor will have the shape (A, N, B, C). Etc.

For example:

# 'x' is [1, 4]
# 'y' is [2, 5]
# 'z' is [3, 6]
pack([x, y, z]) => [[1, 4], [2, 5], [3, 6]]  # Pack along first dim.
pack([x, y, z], axis=1) => [[1, 2, 3], [4, 5, 6]]

This is the opposite of unpack.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
axis ::mlir::IntegerAttr 64-bit signless integer attribute
N ::mlir::Attribute derived attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
values tensor of tf.dtype values

Results:

Result Description
output tensor of tf.dtype values

tf.Pad (::mlir::TF::PadOp)

Pads a tensor with zeros.

This operation pads a input with zeros according to the paddings you specify. paddings is an integer tensor with shape [Dn, 2], where n is the rank of input. For each dimension D of input, paddings[D, 0] indicates how many zeros to add before the contents of input in that dimension, and paddings[D, 1] indicates how many zeros to add after the contents of input in that dimension.

The padded size of each dimension D of the output is:

paddings(D, 0) + input.dim_size(D) + paddings(D, 1)

For example:

# 't' is [[1, 1], [2, 2]]
# 'paddings' is [[1, 1], [2, 2]]
# rank of 't' is 2
pad(t, paddings) ==> [[0, 0, 0, 0, 0, 0]
                      [0, 0, 1, 1, 0, 0]
                      [0, 0, 2, 2, 0, 0]
                      [0, 0, 0, 0, 0, 0]]

Interfaces: NoSideEffect (MemoryEffectOpInterface), TF_FoldOperandsTransposeInterface

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute
Tpaddings ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of tf.dtype values
paddings tensor of 32/64-bit signed integer values

Results:

Result Description
output tensor of tf.dtype values

tf.PadV2 (::mlir::TF::PadV2Op)

Pads a tensor.

This operation pads input according to the paddings and constant_values you specify. paddings is an integer tensor with shape [Dn, 2], where n is the rank of input. For each dimension D of input, paddings[D, 0] indicates how many padding values to add before the contents of input in that dimension, and paddings[D, 1] indicates how many padding values to add after the contents of input in that dimension. constant_values is a scalar tensor of the same type as input that indicates the value to use for padding input.

The padded size of each dimension D of the output is:

paddings(D, 0) + input.dim_size(D) + paddings(D, 1)

For example:

# 't' is [[1, 1], [2, 2]]
# 'paddings' is [[1, 1], [2, 2]]
# 'constant_values' is 0
# rank of 't' is 2
pad(t, paddings) ==> [[0, 0, 0, 0, 0, 0]
                      [0, 0, 1, 1, 0, 0]
                      [0, 0, 2, 2, 0, 0]
                      [0, 0, 0, 0, 0, 0]]

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute
Tpaddings ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of tf.dtype values
paddings tensor of 32/64-bit signed integer values
constant_values tensor of tf.dtype values

Results:

Result Description
output tensor of tf.dtype values

tf.ParallelDynamicStitch (::mlir::TF::ParallelDynamicStitchOp)

Interleave the values from the data tensors into a single tensor.

Builds a merged tensor such that

    merged[indices[m][i, ..., j], ...] = data[m][i, ..., j, ...]

For example, if each indices[m] is scalar or vector, we have

    # Scalar indices:
    merged[indices[m], ...] = data[m][...]

    # Vector indices:
    merged[indices[m][i], ...] = data[m][i, ...]

Each data[i].shape must start with the corresponding indices[i].shape, and the rest of data[i].shape must be constant w.r.t. i. That is, we must have data[i].shape = indices[i].shape + constant. In terms of this constant, the output shape is

merged.shape = [max(indices)] + constant

Values may be merged in parallel, so if an index appears in both indices[m][i] and indices[n][j], the result may be invalid. This differs from the normal DynamicStitch operator that defines the behavior in that case.

For example:

    indices[0] = 6
    indices[1] = [4, 1]
    indices[2] = [[5, 2], [0, 3]]
    data[0] = [61, 62]
    data[1] = [[41, 42], [11, 12]]
    data[2] = [[[51, 52], [21, 22]], [[1, 2], [31, 32]]]
    merged = [[1, 2], [11, 12], [21, 22], [31, 32], [41, 42],
              [51, 52], [61, 62]]

This method can be used to merge partitions created by dynamic_partition as illustrated on the following example:

    # Apply function (increments x_i) on elements for which a certain condition
    # apply (x_i != -1 in this example).
    x=tf.constant([0.1, -1., 5.2, 4.3, -1., 7.4])
    condition_mask=tf.not_equal(x,tf.constant(-1.))
    partitioned_data = tf.dynamic_partition(
        x, tf.cast(condition_mask, tf.int32) , 2)
    partitioned_data[1] = partitioned_data[1] + 1.0
    condition_indices = tf.dynamic_partition(
        tf.range(tf.shape(x)[0]), tf.cast(condition_mask, tf.int32) , 2)
    x = tf.dynamic_stitch(condition_indices, partitioned_data)
    # Here x=[1.1, -1., 6.2, 5.3, -1, 8.4], the -1. values remain
    # unchanged.

Traits: SameVariadicOperandSize

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
N ::mlir::Attribute derived attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
indices tensor of 32-bit integer values
data tensor of tf.dtype values

Results:

Result Description
merged tensor of tf.dtype values

tf.ParallelMapDataset (::mlir::TF::ParallelMapDatasetOp)

Creates a dataset that applies f to the outputs of input_dataset.

Unlike a "MapDataset", which applies f sequentially, this dataset invokes up to num_parallel_calls copies of f in parallel.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
f ::mlir::SymbolRefAttr symbol reference attribute
output_types ::mlir::ArrayAttr type array attribute with at least 1 elements
output_shapes ::mlir::ArrayAttr tensorflow shape attribute array with at least 1 elements
use_inter_op_parallelism ::mlir::BoolAttr bool attribute
sloppy ::mlir::BoolAttr bool attribute
preserve_cardinality ::mlir::BoolAttr bool attribute
metadata ::mlir::StringAttr string attribute
Targuments ::mlir::Attribute derived attribute

Operands:

Operand Description
input_dataset tensor of variant values
other_arguments tensor of tf.dtype values
num_parallel_calls tensor of 32-bit integer values

Results:

Result Description
handle tensor of variant values

tf.ParallelMapDatasetV2 (::mlir::TF::ParallelMapDatasetV2Op)

Creates a dataset that applies f to the outputs of input_dataset.

Unlike a "MapDataset", which applies f sequentially, this dataset invokes up to num_parallel_calls copies of f in parallel.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
f ::mlir::SymbolRefAttr symbol reference attribute
output_types ::mlir::ArrayAttr type array attribute with at least 1 elements
output_shapes ::mlir::ArrayAttr tensorflow shape attribute array with at least 1 elements
use_inter_op_parallelism ::mlir::BoolAttr bool attribute
deterministic ::mlir::StringAttr string attribute
preserve_cardinality ::mlir::BoolAttr bool attribute
metadata ::mlir::StringAttr string attribute
Targuments ::mlir::Attribute derived attribute

Operands:

Operand Description
input_dataset tensor of variant values
other_arguments tensor of tf.dtype values
num_parallel_calls tensor of 64-bit integer values

Results:

Result Description
handle tensor of variant values

tf.ParameterizedTruncatedNormal (::mlir::TF::ParameterizedTruncatedNormalOp)

Outputs random values from a normal distribution. The parameters may each be a

scalar which applies to the entire output, or a vector of length shape[0] which stores the parameters for each batch.

Traits: TF_CannotDuplicate

Attributes:

Attribute MLIR Type Description
seed ::mlir::IntegerAttr 64-bit signless integer attribute
seed2 ::mlir::IntegerAttr 64-bit signless integer attribute
T ::mlir::Attribute derived attribute
dtype ::mlir::Attribute derived attribute

Operands:

Operand Description
shape tensor of 32/64-bit signed integer values
means tensor of floating-point values
stdevs tensor of floating-point values
minvals tensor of floating-point values
maxvals tensor of floating-point values

Results:

Result Description
output tensor of floating-point values

tf.ParseExample (::mlir::TF::ParseExampleOp)

Transforms a vector of tf.Example protos (as strings) into typed tensors.

Traits: AttrSizedOperandSegments, AttrSizedResultSegments

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
dense_shapes ::mlir::ArrayAttr tensorflow shape attribute array
result_segment_sizes ::mlir::DenseIntElementsAttr 32-bit signless integer elements attribute
operand_segment_sizes ::mlir::DenseIntElementsAttr 32-bit signless integer elements attribute
Nsparse ::mlir::Attribute derived attribute
Ndense ::mlir::Attribute derived attribute
Tdense ::mlir::Attribute derived attribute
sparse_types ::mlir::Attribute derived attribute

Operands:

Operand Description
serialized tensor of string values
names tensor of string values
sparse_keys tensor of string values
dense_keys tensor of string values
dense_defaults tensor of 32-bit float or 64-bit integer or string values

Results:

Result Description
sparse_indices tensor of 64-bit integer values
sparse_values tensor of 32-bit float or 64-bit integer or string values
sparse_shapes tensor of 64-bit integer values
dense_values tensor of 32-bit float or 64-bit integer or string values

tf.ParseExampleV2 (::mlir::TF::ParseExampleV2Op)

Transforms a vector of tf.Example protos (as strings) into typed tensors.

Traits: AttrSizedResultSegments

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
num_sparse ::mlir::IntegerAttr 64-bit signless integer attribute whose minimum value is 0
dense_shapes ::mlir::ArrayAttr tensorflow shape attribute array
result_segment_sizes ::mlir::DenseIntElementsAttr 32-bit signless integer elements attribute
Tdense ::mlir::Attribute derived attribute
sparse_types ::mlir::Attribute derived attribute
ragged_value_types ::mlir::Attribute derived attribute
ragged_split_types ::mlir::Attribute derived attribute

Operands:

Operand Description
serialized tensor of string values
names tensor of string values
sparse_keys tensor of string values
dense_keys tensor of string values
ragged_keys tensor of string values
dense_defaults tensor of 32-bit float or 64-bit integer or string values

Results:

Result Description
sparse_indices tensor of 64-bit integer values
sparse_values tensor of 32-bit float or 64-bit integer or string values
sparse_shapes tensor of 64-bit integer values
dense_values tensor of 32-bit float or 64-bit integer or string values
ragged_values tensor of 32-bit float or 64-bit integer or string values
ragged_row_splits tensor of 32-bit integer or 64-bit integer values

tf.PartitionedCall (::mlir::TF::PartitionedCallOp)

returns f(inputs), where f's body is placed and partitioned.

Asynchronously executes a function, potentially across multiple devices but within a single process. The kernel places and partitions a given function's underlying graph, and executes each of the partitioned subgraphs as a function.

Interfaces: CallOpInterface, NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
f ::mlir::SymbolRefAttr symbol reference attribute
config ::mlir::StringAttr string attribute
config_proto ::mlir::StringAttr string attribute
executor_type ::mlir::StringAttr string attribute
Tin ::mlir::Attribute derived attribute
Tout ::mlir::Attribute derived attribute

Operands:

Operand Description
args tensor of tf.dtype values

Results:

Result Description
output tensor of tf.dtype values

tf.Placeholder (::mlir::TF::PlaceholderOp)

Placeholder op

Inserts a placeholder for a tensor that will be always fed.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
dtype ::mlir::Attribute derived attribute

Results:

Result Description
output tensor of tf.dtype values

tf.PlaceholderWithDefault (::mlir::TF::PlaceholderWithDefaultOp)

Placeholder op

A placeholder op that passes through input when its output is not fed.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
dtype ::mlir::Attribute derived attribute
shape ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of tf.dtype values

Results:

Result Description
output tensor of tf.dtype values

tf.Polygamma (::mlir::TF::PolygammaOp)

Compute the polygamma function \(\psi^{(n)}(x)\).

The polygamma function is defined as:

\(\psi^{(a)}(x) = \frac{d^a}{dx^a} \psi(x)\)

where \(\psi(x)\) is the digamma function. The polygamma function is defined only for non-negative integer orders \a\.

Traits: ResultsBroadcastableShape

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
a tensor of 32/64-bit float values
x tensor of 32/64-bit float values

Results:

Result Description
z tensor of 32/64-bit float values

tf.PopulationCount (::mlir::TF::PopulationCountOp)

Computes element-wise population count (a.k.a. popcount, bitsum, bitcount).

For each entry in x, calculates the number of 1 (on) bits in the binary representation of that entry.

Traits: SameOperandsAndResultShape

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of integer values

Results:

Result Description
y tensor of 8-bit unsigned integer values

tf.Pow (::mlir::TF::PowOp)

Computes the power of one value to another.

Given a tensor x and a tensor y, this operation computes \(x^y\) for corresponding elements in x and y. For example:

# tensor 'x' is [[2, 2]], [3, 3]]
# tensor 'y' is [[8, 16], [2, 3]]
tf.pow(x, y) ==> [[256, 65536], [9, 27]]

Traits: ResultsBroadcastableShape, TF_SameOperandsAndResultElementTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer values
y tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer values

Results:

Result Description
z tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer values

tf.PrefetchDataset (::mlir::TF::PrefetchDatasetOp)

Creates a dataset that asynchronously prefetches elements from input_dataset.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
output_types ::mlir::ArrayAttr type array attribute with at least 1 elements
output_shapes ::mlir::ArrayAttr tensorflow shape attribute array with at least 1 elements
slack_period ::mlir::IntegerAttr 64-bit signless integer attribute
legacy_autotune ::mlir::BoolAttr bool attribute
buffer_size_min ::mlir::IntegerAttr 64-bit signless integer attribute
metadata ::mlir::StringAttr string attribute

Operands:

Operand Description
input_dataset tensor of variant values
buffer_size tensor of 64-bit integer values

Results:

Result Description
handle tensor of variant values

tf.PreventGradient (::mlir::TF::PreventGradientOp)

An identity op that triggers an error if a gradient is requested.

When executed in a graph, this op outputs its input tensor as-is.

When building ops to compute gradients, the TensorFlow gradient system will return an error when trying to lookup the gradient of this op, because no gradient must ever be registered for this function. This op exists to prevent subtle bugs from silently returning unimplemented gradients in some corner cases.

Traits: TF_SameOperandsAndResultTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
message ::mlir::StringAttr string attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of tf.dtype values

Results:

Result Description
output tensor of tf.dtype values

tf.Print (::mlir::TF::PrintOp)

Prints a list of tensors.

Passes input through to output and prints data when evaluating.

Attributes:

Attribute MLIR Type Description
message ::mlir::StringAttr string attribute
first_n ::mlir::IntegerAttr 64-bit signless integer attribute
summarize ::mlir::IntegerAttr 64-bit signless integer attribute
T ::mlir::Attribute derived attribute
U ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of tf.dtype values
data tensor of tf.dtype values

Results:

Result Description
output tensor of tf.dtype values

tf.PrintV2 (::mlir::TF::PrintV2Op)

Prints a string scalar.

Prints a string scalar to the desired output_stream.

Attributes:

Attribute MLIR Type Description
output_stream ::mlir::StringAttr string attribute
end ::mlir::StringAttr string attribute

Operands:

Operand Description
input tensor of string values

tf.Prod (::mlir::TF::ProdOp)

Computes the product of elements across dimensions of a tensor.

Reduces input along the dimensions given in axis. Unless keep_dims is true, the rank of the tensor is reduced by 1 for each entry in axis. If keep_dims is true, the reduced dimensions are retained with length 1.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
keep_dims ::mlir::BoolAttr bool attribute
T ::mlir::Attribute derived attribute
Tidx ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values
reduction_indices tensor of 32/64-bit signed integer values

Results:

Result Description
output tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit quantized integer or 8-bit quantized integer or 8-bit quantized unsigned integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

tf.Qr (::mlir::TF::QrOp)

Computes the QR decompositions of one or more matrices.

Computes the QR decomposition of each inner matrix in tensor such that tensor[..., :, :] = q[..., :, :] * r[..., :,:])

Currently, the gradient for the QR decomposition is well-defined only when the first P columns of the inner matrix are linearly independent, where P is the minimum of M and N, the 2 inner-most dimmensions of tensor.

# a is a tensor.
# q is a tensor of orthonormal matrices.
# r is a tensor of upper triangular matrices.
q, r = qr(a)
q_full, r_full = qr(a, full_matrices=True)

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
full_matrices ::mlir::BoolAttr bool attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float values

Results:

Result Description
q tensor of 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float values
r tensor of 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float values

tf.QuantizeAndDequantize (::mlir::TF::QuantizeAndDequantizeOp)

Use QuantizeAndDequantizeV2 instead.

Traits: TF_SameOperandsAndResultTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
signed_input ::mlir::BoolAttr bool attribute
num_bits ::mlir::IntegerAttr 64-bit signless integer attribute
range_given ::mlir::BoolAttr bool attribute
input_min ::mlir::FloatAttr 32-bit float attribute
input_max ::mlir::FloatAttr 32-bit float attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of floating-point values

Results:

Result Description
output tensor of floating-point values

tf.QuantizeAndDequantizeV2 (::mlir::TF::QuantizeAndDequantizeV2Op)

Quantizes then dequantizes a tensor.

This op simulates the precision loss from the quantized forward pass by:

  1. Quantizing the tensor to fixed point numbers, which should match the target quantization method when it is used in inference.
  2. Dequantizing it back to floating point numbers for the following ops, most likely matmul.

There are different ways to quantize. This version uses only scaling, so 0.0 maps to 0.

From the specified 'num_bits' in the quantized output type, it determines minimum and maximum representable quantized values.

e.g.

  • [-128, 127] for signed, num_bits = 8, or
  • [0, 255] for unsigned, num_bits = 8.

If range_given == False, the initial input_min, input_max will be determined automatically as the minimum and maximum values in the input tensor, otherwise the specified values of input_min, input_max are used.

This op determines the maximum scale_factor that would map the initial [input_min, input_max] range to a range that lies within the representable quantized range.

It determines the scale from one of input_min and input_max, then updates the other one to maximize the representable range.

e.g.

  • if the output is signed, num_bits = 8, [input_min, input_max] = [-10.0, 5.0]: it would use a scale_factor of -128 / -10.0 = 12.8 In this case, it would update input_max to be 127 / 12.8 = 9.921875
  • if the output is signed, num_bits = 8, [input_min, input_max] = [-10.0, 10.0]: it would use a scale_factor of 127 / 10.0 = 12.7 In this case, it would update input_min to be 128.0 / 12.7 = -10.07874
  • if the output is unsigned, input_min is forced to be 0, and only the specified input_max is used.

After determining the scale_factor and updating the input range, it applies the following to each value in the 'input' tensor.

output = round(clamp(value, input_min, input_max) * scale_factor) / scale_factor.

The above round function rounds the value based on the given round_mode.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
signed_input ::mlir::BoolAttr bool attribute
num_bits ::mlir::IntegerAttr 64-bit signless integer attribute
range_given ::mlir::BoolAttr bool attribute
round_mode ::mlir::StringAttr string attribute whose value is HALF_TO_EVEN, or HALF_UP
narrow_range ::mlir::BoolAttr bool attribute
axis ::mlir::IntegerAttr 64-bit signless integer attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of floating-point values
input_min tensor of floating-point values
input_max tensor of floating-point values

Results:

Result Description
output tensor of floating-point values

tf.QuantizeAndDequantizeV3 (::mlir::TF::QuantizeAndDequantizeV3Op)

Quantizes then dequantizes a tensor.

This is almost identical to QuantizeAndDequantizeV2, except that num_bits is a tensor, so its value can change during training.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
signed_input ::mlir::BoolAttr bool attribute
range_given ::mlir::BoolAttr bool attribute
narrow_range ::mlir::BoolAttr bool attribute
axis ::mlir::IntegerAttr 64-bit signless integer attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of floating-point values
input_min tensor of floating-point values
input_max tensor of floating-point values
num_bits tensor of 32-bit integer values

Results:

Result Description
output tensor of floating-point values

tf.QuantizeAndDequantizeV4 (::mlir::TF::QuantizeAndDequantizeV4Op)

Quantizes then dequantizes a tensor.

This is almost identical to QuantizeAndDequantizeV2, except that it returns a gradient of 1 for inputs that are within the quantization range, or 0 otherwise.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
signed_input ::mlir::BoolAttr bool attribute
num_bits ::mlir::IntegerAttr 64-bit signless integer attribute
range_given ::mlir::BoolAttr bool attribute
round_mode ::mlir::StringAttr string attribute whose value is HALF_TO_EVEN, or HALF_UP
narrow_range ::mlir::BoolAttr bool attribute
axis ::mlir::IntegerAttr 64-bit signless integer attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of floating-point values
input_min tensor of floating-point values
input_max tensor of floating-point values

Results:

Result Description
output tensor of floating-point values

tf.QuantizeV2 (::mlir::TF::QuantizeV2Op)

Quantize the 'input' tensor of type float to 'output' tensor of type 'T'.

[min_range, max_range] are scalar floats that specify the range for the 'input' data. The 'mode' attribute controls exactly which calculations are used to convert the float values to their quantized equivalents. The 'round_mode' attribute controls which rounding tie-breaking algorithm is used when rounding float values to their quantized equivalents.

In 'MIN_COMBINED' mode, each value of the tensor will undergo the following:

out[i] = (in[i] - min_range) * range(T) / (max_range - min_range)
if T == qint8: out[i] -= (range(T) + 1) / 2.0

here range(T) = numeric_limits<T>::max() - numeric_limits<T>::min()

MIN_COMBINED Mode Example

Assume the input is type float and has a possible range of [0.0, 6.0] and the output type is quint8 ([0, 255]). The min_range and max_range values should be specified as 0.0 and 6.0. Quantizing from float to quint8 will multiply each value of the input by 255/6 and cast to quint8.

If the output type was qint8 ([-128, 127]), the operation will additionally subtract each value by 128 prior to casting, so that the range of values aligns with the range of qint8.

If the mode is 'MIN_FIRST', then this approach is used:

num_discrete_values = 1 << (# of bits in T)
range_adjust = num_discrete_values / (num_discrete_values - 1)
range = (range_max - range_min) * range_adjust
range_scale = num_discrete_values / range
quantized = round(input * range_scale) - round(range_min * range_scale) +
  numeric_limits<T>::min()
quantized = max(quantized, numeric_limits<T>::min())
quantized = min(quantized, numeric_limits<T>::max())

The biggest difference between this and MIN_COMBINED is that the minimum range is rounded first, before it's subtracted from the rounded value. With MIN_COMBINED, a small bias is introduced where repeated iterations of quantizing and dequantizing will introduce a larger and larger error.

SCALED mode Example

SCALED mode matches the quantization approach used in QuantizeAndDequantize{V2|V3}.

If the mode is SCALED, the quantization is performed by multiplying each input value by a scaling_factor. The scaling_factor is determined from min_range and max_range to be as large as possible such that the range from min_range to max_range is representable within values of type T.


  const int min_T = std::numeric_limits<T>::min();
  const int max_T = std::numeric_limits<T>::max();
  const float max_float = std::numeric_limits<float>::max();

  const float scale_factor_from_min_side =
      (min_T * min_range > 0) ? min_T / min_range : max_float;
  const float scale_factor_from_max_side =
      (max_T * max_range > 0) ? max_T / max_range : max_float;

  const float scale_factor = std::min(scale_factor_from_min_side,
                                      scale_factor_from_max_side);

We next use the scale_factor to adjust min_range and max_range as follows:

      min_range = min_T / scale_factor;
      max_range = max_T / scale_factor;

e.g. if T = qint8, and initially min_range = -10, and max_range = 9, we would compare -128/-10.0 = 12.8 to 127/9.0 = 14.11, and set scaling_factor = 12.8 In this case, min_range would remain -10, but max_range would be adjusted to 127 / 12.8 = 9.921875

So we will quantize input values in the range (-10, 9.921875) to (-128, 127).

The input tensor can now be quantized by clipping values to the range min_range to max_range, then multiplying by scale_factor as follows:

result = round(min(max_range, max(min_range, input)) * scale_factor)

The adjusted min_range and max_range are returned as outputs 2 and 3 of this operation. These outputs should be used as the range for any further calculations.

narrow_range (bool) attribute

If true, we do not use the minimum quantized value. i.e. for int8 the quantized output, it would be restricted to the range -127..127 instead of the full -128..127 range. This is provided for compatibility with certain inference backends. (Only applies to SCALED mode)

axis (int) attribute

An optional axis attribute can specify a dimension index of the input tensor, such that quantization ranges will be calculated and applied separately for each slice of the tensor along that dimension. This is useful for per-channel quantization.

If axis is specified, min_range and max_range

if axis=None, per-tensor quantization is performed as normal.

ensure_minimum_range (float) attribute

Ensures the minimum quantization range is at least this value. The legacy default value for this is 0.01, but it is strongly suggested to set it to 0 for new uses.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
mode ::mlir::StringAttr string attribute whose value is MIN_COMBINED, or MIN_FIRST, or SCALED
round_mode ::mlir::StringAttr string attribute whose value is HALF_AWAY_FROM_ZERO, or HALF_TO_EVEN
narrow_range ::mlir::BoolAttr bool attribute
axis ::mlir::IntegerAttr 64-bit signless integer attribute
ensure_minimum_range ::mlir::FloatAttr 32-bit float attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of 32-bit float values
min_range tensor of 32-bit float values
max_range tensor of 32-bit float values

Results:

Result Description
output tensor of 16-bit quantized integer or 32-bit quantized integer or 8-bit quantized integer or 16-bit quantized unsigned integer or 8-bit quantized unsigned integer values
output_min tensor of 32-bit float values
output_max tensor of 32-bit float values

tf.QueueDequeueV2 (::mlir::TF::QueueDequeueV2Op)

Dequeues a tuple of one or more tensors from the given queue.

This operation has k outputs, where k is the number of components in the tuples stored in the given queue, and output i is the ith component of the dequeued tuple.

N.B. If the queue is empty, this operation will block until an element has been dequeued (or 'timeout_ms' elapses, if specified).

Attributes:

Attribute MLIR Type Description
timeout_ms ::mlir::IntegerAttr 64-bit signless integer attribute
component_types ::mlir::Attribute derived attribute

Operands:

Operand Description
handle tensor of resource values

Results:

Result Description
components tensor of tf.dtype values

tf.RFFT2D (::mlir::TF::RFFT2DOp)

2D real-valued fast Fourier transform.

Computes the 2-dimensional discrete Fourier transform of a real-valued signal over the inner-most 2 dimensions of input.

Since the DFT of a real signal is Hermitian-symmetric, RFFT2D only returns the fft_length / 2 + 1 unique components of the FFT for the inner-most dimension of output: the zero-frequency term, followed by the fft_length / 2 positive-frequency terms.

Along each axis RFFT2D is computed on, if fft_length is smaller than the corresponding dimension of input, the dimension is cropped. If it is larger, the dimension is padded with zeros.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
Treal ::mlir::Attribute derived attribute
Tcomplex ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of 32/64-bit float values
fft_length tensor of 32-bit integer values

Results:

Result Description
output tensor of 128-bit complex or 64-bit complex values

tf.RFFT3D (::mlir::TF::RFFT3DOp)

3D real-valued fast Fourier transform.

Computes the 3-dimensional discrete Fourier transform of a real-valued signal over the inner-most 3 dimensions of input.

Since the DFT of a real signal is Hermitian-symmetric, RFFT3D only returns the fft_length / 2 + 1 unique components of the FFT for the inner-most dimension of output: the zero-frequency term, followed by the fft_length / 2 positive-frequency terms.

Along each axis RFFT3D is computed on, if fft_length is smaller than the corresponding dimension of input, the dimension is cropped. If it is larger, the dimension is padded with zeros.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
Treal ::mlir::Attribute derived attribute
Tcomplex ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of 32/64-bit float values
fft_length tensor of 32-bit integer values

Results:

Result Description
output tensor of 128-bit complex or 64-bit complex values

tf.RFFT (::mlir::TF::RFFTOp)

Real-valued fast Fourier transform.

Computes the 1-dimensional discrete Fourier transform of a real-valued signal over the inner-most dimension of input.

Since the DFT of a real signal is Hermitian-symmetric, RFFT only returns the fft_length / 2 + 1 unique components of the FFT: the zero-frequency term, followed by the fft_length / 2 positive-frequency terms.

Along the axis RFFT is computed on, if fft_length is smaller than the corresponding dimension of input, the dimension is cropped. If it is larger, the dimension is padded with zeros.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
Treal ::mlir::Attribute derived attribute
Tcomplex ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of 32/64-bit float values
fft_length tensor of 32-bit integer values

Results:

Result Description
output tensor of 128-bit complex or 64-bit complex values

tf.RGBToHSV (::mlir::TF::RGBToHSVOp)

Converts one or more images from RGB to HSV.

Outputs a tensor of the same shape as the images tensor, containing the HSV value of the pixels. The output is only well defined if the value in images are in [0,1].

output[..., 0] contains hue, output[..., 1] contains saturation, and output[..., 2] contains value. All HSV values are in [0,1]. A hue of 0 corresponds to pure red, hue 1/3 is pure green, and 2/3 is pure blue.

Usage Example:

blue_image = tf.stack([ ... tf.zeros([5,5]), ... tf.zeros([5,5]), ... tf.ones([5,5])], ... axis=-1) blue_hsv_image = tf.image.rgb_to_hsv(blue_image) blue_hsv_image[0,0].numpy() array([0.6666667, 1. , 1. ], dtype=float32)

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
images tensor of floating-point values

Results:

Result Description
output tensor of floating-point values

tf.RaggedGather (::mlir::TF::RaggedGatherOp)

Gather ragged slices from params axis 0 according to indices.

Outputs a RaggedTensor output composed from output_dense_values and output_nested_splits, such that:

output.shape = indices.shape + params.shape[1:]
output.ragged_rank = indices.shape.ndims + params.ragged_rank
output[i...j, d0...dn] = params[indices[i...j], d0...dn]

where

  • params = ragged.from_nested_row_splits(params_dense_values, params_nested_splits) provides the values that should be gathered.
  • indices ia a dense tensor with dtype int32 or int64, indicating which values should be gathered.
  • output = ragged.from_nested_row_splits(output_dense_values, output_nested_splits) is the output tensor.

(Note: This c++ op is used to implement the higher-level python tf.ragged.gather op, which also supports ragged indices.)

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
PARAMS_RAGGED_RANK ::mlir::Attribute derived attribute
Tindices ::mlir::Attribute derived attribute
Tsplits ::mlir::Attribute derived attribute
Tvalues ::mlir::Attribute derived attribute
OUTPUT_RAGGED_RANK ::mlir::Attribute derived attribute

Operands:

Operand Description
params_nested_splits tensor of 32/64-bit signed integer values
params_dense_values tensor of tf.dtype values
indices tensor of 32/64-bit signed integer values

Results:

Result Description
output_nested_splits tensor of 32/64-bit signed integer values
output_dense_values tensor of tf.dtype values

tf.RaggedRange (::mlir::TF::RaggedRangeOp)

Returns a RaggedTensor containing the specified sequences of numbers.

Returns a RaggedTensor result composed from rt_dense_values and rt_nested_splits, such that result[i] = range(starts[i], limits[i], deltas[i]).

(rt_nested_splits, rt_dense_values) = ragged_range(
      starts=[2, 5, 8], limits=[3, 5, 12], deltas=1)
result = tf.ragged.from_row_splits(rt_dense_values, rt_nested_splits)
print(result)
<tf.RaggedTensor [[2], [], [8, 9, 10, 11]] >

The input tensors starts, limits, and deltas may be scalars or vectors. The vector inputs must all have the same size. Scalar inputs are broadcast to match the size of the vector inputs.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute
Tsplits ::mlir::Attribute derived attribute

Operands:

Operand Description
starts tensor of bfloat16 or 32-bit float or 64-bit float or 32-bit integer or 64-bit integer values
limits tensor of bfloat16 or 32-bit float or 64-bit float or 32-bit integer or 64-bit integer values
deltas tensor of bfloat16 or 32-bit float or 64-bit float or 32-bit integer or 64-bit integer values

Results:

Result Description
rt_nested_splits tensor of 32/64-bit signed integer values
rt_dense_values tensor of bfloat16 or 32-bit float or 64-bit float or 32-bit integer or 64-bit integer values

tf.RandomGammaGrad (::mlir::TF::RandomGammaGradOp)

Computes the derivative of a Gamma random sample w.r.t. alpha.

Traits: ResultsBroadcastableShape

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
alpha tensor of 32/64-bit float values
sample tensor of 32/64-bit float values

Results:

Result Description
output tensor of 32/64-bit float values

tf.RandomGamma (::mlir::TF::RandomGammaOp)

Outputs random values from the Gamma distribution(s) described by alpha.

This op uses the algorithm by Marsaglia et al. to acquire samples via transformation-rejection from pairs of uniform and normal random variables. See http://dl.acm.org/citation.cfm?id=358414

Traits: TF_CannotDuplicate

Attributes:

Attribute MLIR Type Description
seed ::mlir::IntegerAttr 64-bit signless integer attribute
seed2 ::mlir::IntegerAttr 64-bit signless integer attribute
S ::mlir::Attribute derived attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
shape tensor of 32/64-bit signed integer values
alpha tensor of 16-bit float or 32-bit float or 64-bit float values

Results:

Result Description
output tensor of 16-bit float or 32-bit float or 64-bit float values

tf.RandomPoisson (::mlir::TF::RandomPoissonOp)

Use RandomPoissonV2 instead.

Traits: TF_CannotDuplicate

Attributes:

Attribute MLIR Type Description
seed ::mlir::IntegerAttr 64-bit signless integer attribute
seed2 ::mlir::IntegerAttr 64-bit signless integer attribute
S ::mlir::Attribute derived attribute
dtype ::mlir::Attribute derived attribute

Operands:

Operand Description
shape tensor of 32/64-bit signed integer values
rate tensor of 16-bit float or 32-bit float or 64-bit float values

Results:

Result Description
output tensor of 16-bit float or 32-bit float or 64-bit float values

tf.RandomPoissonV2 (::mlir::TF::RandomPoissonV2Op)

Outputs random values from the Poisson distribution(s) described by rate.

This op uses two algorithms, depending on rate. If rate >= 10, then the algorithm by Hormann is used to acquire samples via transformation-rejection. See http://www.sciencedirect.com/science/article/pii/0167668793909974

Otherwise, Knuth's algorithm is used to acquire samples via multiplying uniform random variables. See Donald E. Knuth (1969). Seminumerical Algorithms. The Art of Computer Programming, Volume 2. Addison Wesley

Traits: TF_CannotDuplicate

Attributes:

Attribute MLIR Type Description
seed ::mlir::IntegerAttr 64-bit signless integer attribute
seed2 ::mlir::IntegerAttr 64-bit signless integer attribute
R ::mlir::Attribute derived attribute
S ::mlir::Attribute derived attribute
dtype ::mlir::Attribute derived attribute

Operands:

Operand Description
shape tensor of 32/64-bit signed integer values
rate tensor of 16-bit float or 32-bit float or 64-bit float or 32-bit integer or 64-bit integer values

Results:

Result Description
output tensor of 16-bit float or 32-bit float or 64-bit float or 32-bit integer or 64-bit integer values

tf.RandomShuffle (::mlir::TF::RandomShuffleOp)

Randomly shuffles a tensor along its first dimension.

The tensor is shuffled along dimension 0, such that each value[j] is mapped to one and only one output[i]. For example, a mapping that might occur for a 3x2 tensor is:

[[1, 2],       [[5, 6],
 [3, 4],  ==>   [1, 2],
 [5, 6]]        [3, 4]]

Traits: TF_CannotDuplicate, TF_SameOperandsAndResultTypeResolveRef

Attributes:

Attribute MLIR Type Description
seed ::mlir::IntegerAttr 64-bit signless integer attribute
seed2 ::mlir::IntegerAttr 64-bit signless integer attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
value tensor of tf.dtype values

Results:

Result Description
output tensor of tf.dtype values

tf.RandomStandardNormal (::mlir::TF::RandomStandardNormalOp)

Outputs random values from a normal distribution.

The generated values will have mean 0 and standard deviation 1.

Traits: TF_CannotDuplicate

Attributes:

Attribute MLIR Type Description
seed ::mlir::IntegerAttr 64-bit signless integer attribute
seed2 ::mlir::IntegerAttr 64-bit signless integer attribute
T ::mlir::Attribute derived attribute
dtype ::mlir::Attribute derived attribute

Operands:

Operand Description
shape tensor of 32/64-bit signed integer values

Results:

Result Description
output tensor of floating-point values

tf.RandomUniformInt (::mlir::TF::RandomUniformIntOp)

Outputs random integers from a uniform distribution.

The generated values are uniform integers in the range [minval, maxval). The lower bound minval is included in the range, while the upper bound maxval is excluded.

The random integers are slightly biased unless maxval - minval is an exact power of two. The bias is small for values of maxval - minval significantly smaller than the range of the output (either 2^32 or 2^64).

Traits: TF_CannotDuplicate

Attributes:

Attribute MLIR Type Description
seed ::mlir::IntegerAttr 64-bit signless integer attribute
seed2 ::mlir::IntegerAttr 64-bit signless integer attribute
T ::mlir::Attribute derived attribute
Tout ::mlir::Attribute derived attribute

Operands:

Operand Description
shape tensor of 32/64-bit signed integer values
minval tensor of 32/64-bit signed integer values
maxval tensor of 32/64-bit signed integer values

Results:

Result Description
output tensor of 32/64-bit signed integer values

tf.RandomUniform (::mlir::TF::RandomUniformOp)

Outputs random values from a uniform distribution.

The generated values follow a uniform distribution in the range [0, 1). The lower bound 0 is included in the range, while the upper bound 1 is excluded.

Traits: TF_CannotDuplicate

Attributes:

Attribute MLIR Type Description
seed ::mlir::IntegerAttr 64-bit signless integer attribute
seed2 ::mlir::IntegerAttr 64-bit signless integer attribute
T ::mlir::Attribute derived attribute
dtype ::mlir::Attribute derived attribute

Operands:

Operand Description
shape tensor of 32/64-bit signed integer values

Results:

Result Description
output tensor of floating-point values

tf.RangeDataset (::mlir::TF::RangeDatasetOp)

Creates a dataset with a range of values. Corresponds to python's xrange.

Traits: TF_NoConstantFold

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
output_types ::mlir::ArrayAttr type array attribute with at least 1 elements
output_shapes ::mlir::ArrayAttr tensorflow shape attribute array with at least 1 elements
metadata ::mlir::StringAttr string attribute

Operands:

Operand Description
start tensor of 64-bit integer values
stop tensor of 64-bit integer values
step tensor of 64-bit integer values

Results:

Result Description
handle tensor of variant values

tf.Range (::mlir::TF::RangeOp)

Creates a sequence of numbers.

This operation creates a sequence of numbers that begins at start and extends by increments of delta up to but not including limit.

For example:

# 'start' is 3
# 'limit' is 18
# 'delta' is 3
tf.range(start, limit, delta) ==> [3, 6, 9, 12, 15]

Traits: TF_SameOperandsAndResultElementTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
Tidx ::mlir::Attribute derived attribute

Operands:

Operand Description
start tensor of bfloat16 or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit unsigned integer values
limit tensor of bfloat16 or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit unsigned integer values
delta tensor of bfloat16 or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit unsigned integer values

Results:

Result Description
output tensor of bfloat16 or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 32-bit unsigned integer values

tf.Rank (::mlir::TF::RankOp)

Returns the rank of a tensor.

This operation returns an integer representing the rank of input.

For example:

# 't' is [[[1, 1, 1], [2, 2, 2]], [[3, 3, 3], [4, 4, 4]]]
# shape of tensor 't' is [2, 2, 3]
rank(t) ==> 3

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of tf.dtype values

Results:

Result Description
output tensor of 32-bit integer values

tf.ReadVariableOp (::mlir::TF::ReadVariableOp)

Reads the value of a variable.

The tensor returned by this operation is immutable.

The value returned by this operation is guaranteed to be influenced by all the writes on which this operation depends directly or indirectly, and to not be influenced by any of the writes which depend directly or indirectly on this operation.

Attributes:

Attribute MLIR Type Description
dtype ::mlir::Attribute derived attribute

Operands:

Operand Description
resource tensor of resource values

Results:

Result Description
value tensor of tf.dtype values

tf.RealDiv (::mlir::TF::RealDivOp)

Returns x / y element-wise for real types.

If x and y are reals, this will return the floating-point division.

Traits: ResultsBroadcastableShape, TF_CwiseBinary

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values
y tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

Results:

Result Description
z tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

tf.Real (::mlir::TF::RealOp)

Returns the real part of a complex number.

Given a tensor input of complex numbers, this operation returns a tensor of type float that is the real part of each element in input. All elements in input must be complex numbers of the form \(a + bj\), where a is the real part returned by this operation and b is the imaginary part.

For example:

# tensor 'input' is [-2.25 + 4.75j, 3.25 + 5.75j]
tf.real(input) ==> [-2.25, 3.25]

Traits: SameOperandsAndResultShape

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute
Tout ::mlir::Attribute derived attribute

Operands:

Operand Description
input tensor of 128-bit complex or 64-bit complex values

Results:

Result Description
output tensor of 32/64-bit float values

tf.ReciprocalGrad (::mlir::TF::ReciprocalGradOp)

Computes the gradient for the inverse of x wrt its input.

Specifically, grad = -dy * y*y, where y = 1/x, and dy is the corresponding input gradient.

Traits: TF_SameOperandsAndResultTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
y tensor of floating-point or complex values
dy tensor of floating-point or complex values

Results:

Result Description
z tensor of floating-point or complex values

tf.Reciprocal (::mlir::TF::ReciprocalOp)

Computes the reciprocal of x element-wise.

I.e., \(y = 1 / x\).

Traits: Involution, SameOperandsAndResultType

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
x tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer values

Results:

Result Description
y tensor of bfloat16 or 128-bit complex or 64-bit complex or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer values

tf.Recv (::mlir::TF::RecvOp)

Receives the named tensor from send_device on recv_device.

Attributes:

Attribute MLIR Type Description
tensor_name ::mlir::StringAttr string attribute
send_device ::mlir::StringAttr string attribute
send_device_incarnation ::mlir::IntegerAttr 64-bit signless integer attribute
recv_device ::mlir::StringAttr string attribute
client_terminated ::mlir::BoolAttr bool attribute
tensor_type ::mlir::Attribute derived attribute

Results:

Result Description
tensor tensor of tf.dtype values

tf.RecvTPUEmbeddingActivations (::mlir::TF::RecvTPUEmbeddingActivationsOp)

An op that receives embedding activations on the TPU.

The TPU system performs the embedding lookups and aggregations specified by the arguments to TPUEmbeddingEnqueue(Integer/Sparse/SparseTensor)Batch. The results of these aggregations are visible to the Tensorflow Graph as the outputs of a RecvTPUEmbeddingActivations op. This op returns a list containing one Tensor of activations per table specified in the model. There can be at most one RecvTPUEmbeddingActivations op in the TPU graph.

Interfaces: TF_MustExecute (MemoryEffectOpInterface), TF_TPUEmbeddingReadEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{MemoryEffects::Read on ::mlir::TF::ResourceEffects::TPUEmbedding}, MemoryEffects::Effect{MemoryEffects::Write on ::mlir::TF::ResourceEffects::MustExecute}

Attributes:

Attribute MLIR Type Description
config ::mlir::StringAttr string attribute
num_outputs ::mlir::Attribute derived attribute

Results:

Result Description
outputs tensor of 32-bit float values

tf.ReduceDataset (::mlir::TF::ReduceDatasetOp)

Reduces the input dataset to a singleton using a reduce function.

Traits: SameVariadicOperandSize

Attributes:

Attribute MLIR Type Description
f ::mlir::SymbolRefAttr symbol reference attribute
Tstate ::mlir::ArrayAttr type array attribute with at least 1 elements
Targuments ::mlir::ArrayAttr type array attribute with at least 0 elements
output_types ::mlir::ArrayAttr type array attribute with at least 1 elements
output_shapes ::mlir::ArrayAttr tensorflow shape attribute array with at least 1 elements
use_inter_op_parallelism ::mlir::BoolAttr bool attribute

Operands:

Operand Description
input_dataset tensor of variant values
initial_state tensor of tf.dtype values
other_arguments tensor of tf.dtype values

Results:

Result Description
components tensor of tf.dtype values

tf.ReduceJoin (::mlir::TF::ReduceJoinOp)

Joins a string Tensor across the given dimensions.

Computes the string join across dimensions in the given string Tensor of shape [\\(d_0, d_1, ..., d_{n-1}\\)]. Returns a new Tensor created by joining the input strings with the given separator (default: empty string). Negative indices are counted backwards from the end, with -1 being equivalent to n - 1. If indices are not specified, joins across all dimensions beginning from n - 1 through 0.

For example:

# tensor `a` is [["a", "b"], ["c", "d"]]
tf.reduce_join(a, 0) ==> ["ac", "bd"]
tf.reduce_join(a, 1) ==> ["ab", "cd"]
tf.reduce_join(a, -2) = tf.reduce_join(a, 0) ==> ["ac", "bd"]
tf.reduce_join(a, -1) = tf.reduce_join(a, 1) ==> ["ab", "cd"]
tf.reduce_join(a, 0, keep_dims=True) ==> [["ac", "bd"]]
tf.reduce_join(a, 1, keep_dims=True) ==> [["ab"], ["cd"]]
tf.reduce_join(a, 0, separator=".") ==> ["a.c", "b.d"]
tf.reduce_join(a, [0, 1]) ==> "acbd"
tf.reduce_join(a, [1, 0]) ==> "abcd"
tf.reduce_join(a, []) ==> [["a", "b"], ["c", "d"]]
tf.reduce_join(a) = tf.reduce_join(a, [1, 0]) ==> "abcd"

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
keep_dims ::mlir::BoolAttr bool attribute
separator ::mlir::StringAttr string attribute

Operands:

Operand Description
inputs tensor of string values
reduction_indices tensor of 32-bit integer values

Results:

Result Description
output tensor of string values

tf.Relu6Grad (::mlir::TF::Relu6GradOp)

Computes rectified linear 6 gradients for a Relu6 operation.

Traits: TF_SameOperandsAndResultTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
gradients tensor of integer or floating-point values
features tensor of integer or floating-point values

Results:

Result Description
backprops tensor of integer or floating-point values

tf.Relu6 (::mlir::TF::Relu6Op)

Computes rectified linear 6: min(max(features, 0), 6).

Traits: Idempotent, SameOperandsAndResultType

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
features tensor of integer or floating-point values

Results:

Result Description
activations tensor of integer or floating-point values

tf.ReluGrad (::mlir::TF::ReluGradOp)

Computes rectified linear gradients for a Relu operation.

Traits: TF_SameOperandsAndResultTypeResolveRef

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
gradients tensor of integer or floating-point values
features tensor of integer or floating-point values

Results:

Result Description
backprops tensor of integer or floating-point values

tf.Relu (::mlir::TF::ReluOp)

Computes rectified linear: max(features, 0).

See: https://en.wikipedia.org/wiki/Rectifier_(neural_networks) Example usage:

tf.nn.relu([-2., 0., 3.]).numpy() array([0., 0., 3.], dtype=float32)

Traits: Idempotent, SameOperandsAndResultType, TF_LayoutAgnostic

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute

Operands:

Operand Description
features tensor of bfloat16 or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 8-bit quantized integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

Results:

Result Description
activations tensor of bfloat16 or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 8-bit quantized integer or 16-bit unsigned integer or 32-bit unsigned integer or 64-bit unsigned integer or 8-bit unsigned integer values

tf.RemoteCall (::mlir::TF::RemoteCallOp)

Runs function f on a remote device indicated by target.

Attributes:

Attribute MLIR Type Description
f ::mlir::SymbolRefAttr symbol reference attribute
Tin ::mlir::Attribute derived attribute
Tout ::mlir::Attribute derived attribute

Operands:

Operand Description
target tensor of string values
args tensor of tf.dtype values

Results:

Result Description
output tensor of tf.dtype values

tf.RepeatDataset (::mlir::TF::RepeatDatasetOp)

Creates a dataset that emits the outputs of input_dataset count times.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
output_types ::mlir::ArrayAttr type array attribute with at least 1 elements
output_shapes ::mlir::ArrayAttr tensorflow shape attribute array with at least 1 elements
metadata ::mlir::StringAttr string attribute

Operands:

Operand Description
input_dataset tensor of variant values
count tensor of 64-bit integer values

Results:

Result Description
handle tensor of variant values

tf.Reshape (::mlir::TF::ReshapeOp)

Reshapes a tensor.

Given tensor, this operation returns a tensor that has the same values as tensor with shape shape.

If one component of 1-D tensor shape is the special value -1, the size of that dimension is computed so that the total size remains constant. In particular, a shape of [-1] flattens into 1-D. At most one component of shape may be unknown.

The shape must be 1-D and the operation returns a tensor with shape shape filled with the values of tensor. In this case, the number of elements implied by shape must be the same as the number of elements in tensor.

It is an error if shape is not 1-D.

For example:

# tensor 't' is [1, 2, 3, 4, 5, 6, 7, 8, 9]
# tensor 't' has shape [9]
reshape(t, [3, 3]) ==> [[1, 2, 3],
                        [4, 5, 6],
                        [7, 8, 9]]

# tensor 't' is [[[1, 1], [2, 2]],
#                [[3, 3], [4, 4]]]
# tensor 't' has shape [2, 2, 2]
reshape(t, [2, 4]) ==> [[1, 1, 2, 2],
                        [3, 3, 4, 4]]

# tensor 't' is [[[1, 1, 1],
#                 [2, 2, 2]],
#                [[3, 3, 3],
#                 [4, 4, 4]],
#                [[5, 5, 5],
#                 [6, 6, 6]]]
# tensor 't' has shape [3, 2, 3]
# pass '[-1]' to flatten 't'
reshape(t, [-1]) ==> [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6]

# -1 can also be used to infer the shape

# -1 is inferred to be 9:
reshape(t, [2, -1]) ==> [[1, 1, 1, 2, 2, 2, 3, 3, 3],
                         [4, 4, 4, 5, 5, 5, 6, 6, 6]]
# -1 is inferred to be 2:
reshape(t, [-1, 9]) ==> [[1, 1, 1, 2, 2, 2, 3, 3, 3],
                         [4, 4, 4, 5, 5, 5, 6, 6, 6]]
# -1 is inferred to be 3:
reshape(t, [ 2, -1, 3]) ==> [[[1, 1, 1],
                              [2, 2, 2],
                              [3, 3, 3]],
                             [[4, 4, 4],
                              [5, 5, 5],
                              [6, 6, 6]]]

# tensor 't' is [7]
# shape `[]` reshapes to a scalar
reshape(t, []) ==> 7

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
T ::mlir::Attribute derived attribute
Tshape ::mlir::Attribute derived attribute

Operands:

Operand Description
tensor tensor of tf.dtype values
shape tensor of 32/64-bit signed integer values

Results:

Result Description
output tensor of tf.dtype values

tf.ResizeBilinearGrad (::mlir::TF::ResizeBilinearGradOp)

Computes the gradient of bilinear interpolation.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
align_corners ::mlir::BoolAttr bool attribute
half_pixel_centers ::mlir::BoolAttr bool attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
grads tensor of 32-bit float values
original_image tensor of floating-point values

Results:

Result Description
output tensor of floating-point values

tf.ResizeBilinear (::mlir::TF::ResizeBilinearOp)

Resize images to size using bilinear interpolation.

Input images can be of different types but output images are always float.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
align_corners ::mlir::BoolAttr bool attribute
half_pixel_centers ::mlir::BoolAttr bool attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
images tensor of bfloat16 or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 16-bit unsigned integer or 8-bit unsigned integer values
size tensor of 32-bit integer values

Results:

Result Description
resized_images tensor of 32-bit float values

tf.ResizeNearestNeighborGrad (::mlir::TF::ResizeNearestNeighborGradOp)

Computes the gradient of nearest neighbor interpolation.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
align_corners ::mlir::BoolAttr bool attribute
half_pixel_centers ::mlir::BoolAttr bool attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
grads tensor of bfloat16 or 16-bit float or 32-bit float or 64-bit float or 32-bit integer or 8-bit integer or 8-bit unsigned integer values
size tensor of 32-bit integer values

Results:

Result Description
output tensor of bfloat16 or 16-bit float or 32-bit float or 64-bit float or 32-bit integer or 8-bit integer or 8-bit unsigned integer values

tf.ResizeNearestNeighbor (::mlir::TF::ResizeNearestNeighborOp)

Resize images to size using nearest neighbor interpolation.

Interfaces: NoSideEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

Attribute MLIR Type Description
align_corners ::mlir::BoolAttr bool attribute
half_pixel_centers ::mlir::BoolAttr bool attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
images tensor of bfloat16 or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 16-bit unsigned integer or 8-bit unsigned integer values
size tensor of 32-bit integer values

Results:

Result Description
resized_images tensor of bfloat16 or 16-bit float or 32-bit float or 64-bit float or 16-bit integer or 32-bit integer or 64-bit integer or 8-bit integer or 16-bit unsigned integer or 8-bit unsigned integer values

tf.ResourceApplyAdaMax (::mlir::TF::ResourceApplyAdaMaxOp)

Update '*var' according to the AdaMax algorithm.

mt <- beta1 * m{t-1} + (1 - beta1) * g vt <- max(beta2 * v{t-1}, abs(g)) variable <- variable - learning_rate / (1 - beta1^t) * m_t / (v_t + epsilon)

Attributes:

Attribute MLIR Type Description
use_locking ::mlir::BoolAttr bool attribute
T ::mlir::Attribute derived attribute

Operands:

Operand Description
var tensor of resource values
m tensor of resource values
v tensor of resource values