Control Flow

dragon.operators.control_flow.Copy(inputs, **kwargs)

Copy the value to ref.

The size of value and ref should be same.

Type Constraints: (bool, int8, uint8, int32, int64, float16, float32, float64)

Parameters:inputs (sequence of Tensor) – The ref and value respectively.
Returns:The ref.
Return type:Tensor
dragon.operators.control_flow.Assign(inputs, starts=None, sizes=None, **kwargs)

Assign the value to ref.

The value of sizes could be set to -1 (to end) or 0 (squeeze).

Type Constraints: (bool, int8, uint8, int32, int64, float16, float32, float64)

Parameters:
  • inputs (sequence of Tensor) – The ref and value respectively.
  • starts (sequence of (int, Tensor), optional) – The start pos of each dimension.
  • sizes (sequence of (int, Tensor), optional) – The size of each dimension.
Returns:

The ref.

Return type:

Tensor

dragon.operators.control_flow.MaskedAssign(inputs, mask, **kwargs)

Assign the value to ref where mask is 1.

Type Constraints: (bool, int8, uint8, int32, int64, float16, float32, float64)

Parameters:
  • inputs (sequence of Tensor) – The ref and value respectively.
  • mask (Tensor) – The mask, with the same size as ref.
Returns:

The ref.

Return type:

Tensor

dragon.operators.control_flow.Equal(inputs, to_uint8=False, **kwargs)

Equal comparing between A and B.

Set to_uint8 if you expect the uint8 results instead of bool.

Type Constraints: (bool, int8, uint8, int32, int64, float16, float32, float64)

Parameters:
  • inputs (sequence of Tensor) – The inputs, represent A and B respectively.
  • to_uint8 (bool) – True to convert to uint8 results.
Returns:

The comparing results.

Return type:

Tensor

dragon.operators.control_flow.NotEqual(inputs, to_uint8=False, **kwargs)

NotEqual comparing between A and B.

Set to_uint8 if you expect the uint8 results instead of bool.

Type Constraints: (bool, int8, uint8, int32, int64, float16, float32, float64)

Parameters:
  • inputs (sequence of Tensor) – The inputs, represent A and B respectively.
  • to_uint8 (bool) – True to convert to uint8 results.
Returns:

The comparing results.

Return type:

Tensor

dragon.operators.control_flow.Less(inputs, to_uint8=False, **kwargs)

Less comparing between A and B.

Set to_uint8 if you expect the uint8 results instead of bool.

Type Constraints: (bool, int8, uint8, int32, int64, float16, float32, float64)

Parameters:
  • inputs (sequence of Tensor) – The inputs, represent A and B respectively.
  • to_uint8 (bool) – True to convert to uint8 results.
Returns:

The comparing results.

Return type:

Tensor

dragon.operators.control_flow.LessEqual(inputs, to_uint8=False, **kwargs)

LessEqual comparing between A and B.

Set to_uint8 if you expect the uint8 results instead of bool.

Type Constraints: (bool, int8, uint8, int32, int64, float16, float32, float64)

Parameters:
  • inputs (sequence of Tensor) – The inputs, represent A and B respectively.
  • to_uint8 (bool) – True to convert to uint8 results.
Returns:

The comparing results.

Return type:

Tensor

dragon.operators.control_flow.Greater(inputs, to_uint8=False, **kwargs)

Greater comparing between A and B.

Set to_uint8 if you expect the uint8 results instead of bool.

Type Constraints: (bool, int8, uint8, int32, int64, float16, float32, float64)

Parameters:
  • inputs (sequence of Tensor) – The inputs, represent A and B respectively.
  • to_uint8 (bool) – True to convert to uint8 results.
Returns:

The comparing results.

Return type:

Tensor

dragon.operators.control_flow.GreaterEqual(inputs, to_uint8=False, **kwargs)

GreaterEqual comparing between A and B.

Set to_uint8 if you expect the uint8 results instead of bool.

Type Constraints: (bool, int8, uint8, int32, int64, float16, float32, float64)

Parameters:
  • inputs (sequence of Tensor) – The inputs, represent A and B respectively.
  • to_uint8 (bool) – True to convert to uint8 results.
Returns:

The comparing results.

Return type:

Tensor