TF 2.0 is out! Get hands-on practice at TF World, Oct 28-31. Use code TF20 for 20% off select passes. Register now

tfp.experimental.auto_batching.instructions.Block

View source on GitHub

Class Block

A basic block.

Aliases:

__init__

View source

__init__(
    instructions=None,
    terminator=None,
    name=None
)

Initialize a Block.

A basic block is a sequence of instructions that are always executed in order from first to last. After the last instruction is executed, the block transfers control as indicated by the control transfer instruction in the terminator field.

Pre-lowering, FunctionCallOp is admissible as an internal instruction in a Block, on the grounds that it returns to a fixed place, and the block is guaranteed to continue executing.

Args:

  • instructions: A list of PrimOp, PopOp, and FunctionCallOp instructions to execute in order. Control transfer instructions (that do not return) are not permitted in this list.
  • terminator: A single BranchOp, GotoOp, PushGotoOp or IndirectGotoOp, indicating how to transfer control out of this basic block.
  • name: An object serving as the name of this Block, for display.

Properties

label_str

A string suitable for referring to this Block in printed output.

Methods

assign_instructions

View source

assign_instructions(instructions)

Assigns the body instructions and the terminator at once.

This is a convenience method, to set a Block's program content in one invocation instead of having to assign the instructions and the terminator fields separately.

Args:

  • instructions: A non-empty Python list of Op objects. The last one must be a BranchOp, GotoOp, PushGotoOp, or IndirectGotoOp, and becomes the terminator. The others, if any, must be PrimOp, PopOp, or FunctionCallOp, and become the instructions, in order.