parameters: (self, block)
docstring: Add op_device attrribute for ops in block that have 
          not that attribute set.
          
          Args:
              block (Block): the block to process.
docstring_summary: Add op_device attrribute for ops in block that have 
          not that attribute set.
          
          Args:
              block (Block): the block to process.
docstring_tokens: Add op_device attrribute for ops in block that have not that attribute set . Args : block ( Block ) : the block to process .
function: def _add_op_device_attr(self, block):
          """
          Add op_device attrribute for ops in block that have 
          not that attribute set.
          
          Args:
              block (Block): the block to process.
          """
          assert isinstance(block, Block)
  
          # Ops should be copied to all pipeline stages.
          device_all_ops = [
              "create_py_reader",
              "read",
              "create_double_buffer_reader",
              "while",
          ]
  
          for op in block.ops:
              if op.type in device_all_ops:
                  # We use "gpu:all" to represent an op should be put on all
                  # pipeline stages, such as read ops. Note that: "gpu:all"
                  # is only used by pipeline as an indicator.
                  op._set_attr(self._op_device_key, self._device + ":all")
              if op.type == "while":
                  sub_block_id = op.attr('sub_block').id
                  sub_block = block.program.block(sub_block_id)
                  self._add_op_device_attr(sub_block)
function_tokens: def _add_op_device_attr ( self , block ) : assert isinstance ( block , Block ) # Ops should be copied to all pipeline stages. device_all_ops = [ "create_py_reader" , "read" , "create_double_buffer_reader" , "while" , ] for op in block . ops : if op . type in device_all_ops : # We use "gpu:all" to represent an op should be put on all # pipeline stages, such as read ops. Note that: "gpu:all" # is only used by pipeline as an indicator. op . _set_attr ( self . _op_device_key , self . _device + ":all" ) if op . type == "while" : sub_block_id = op . attr ( 'sub_block' ) . id sub_block = block . program . block ( sub_block_id ) self . _add_op_device_attr ( sub_block )