示例#1
0
 def destructure(self):
     assert self.c_local_shaped_buffer is not None
     result = c_api.DestructureLocalShapedBufferTuple(
         self.c_local_shaped_buffer)
     self.c_local_shaped_buffer = None
     size = result.size()
     destructured = tuple(
         LocalBuffer(result.Release(i)) for i in xrange(size))
     return destructured
示例#2
0
 def destructure(self):
   """Assuming a tuple buffer, unpack it into constituent tuple elements."""
   assert self.c_buffer is not None
   if self._backend.backend_type == BackendType.XRT:
     result = c_api.DestructureXrtAllocationTuple(self.c_buffer,
                                                  self._backend.target)
   else:
     result = c_api.DestructureLocalShapedBufferTuple(self.c_buffer)
   self.delete()
   size = result.size()
   destructured = tuple(
       LocalBuffer(result.Release(i), backend=self._backend)
       for i in xrange(size))
   return destructured