Deeploy.DeeployTypes.TransientBuffer

class Deeploy.DeeployTypes.TransientBuffer(name: str = '', size=0)

Bases: VariableBuffer

Class to represent memory space required by kernels that is not covered by input and output tensors, e.g. im2col buffers in convolutions

Methods

__init__(name: str = '', size=0)

__init__([name, size])

alloc()

Return a string representation of the C code required to allocated this memory buffer

dealloc()

Return a string representation of the C code to deallocate/free this memory buffer at runtime

fromNode(node)

has_live_aliases(ctxt)

Checks whether this VariableBuffer has any live ancestors, i.e. buffers that are still live and are aliased by this buffer.

init()

Return a string representation of the C code to declare this memory buffer

sizeInBytes()

Returns the size of this VariableBuffer in bytes

Attributes

initTemplate

Holds the buffer's initialization code

allocTemplate

Holds the buffer's allocation code

deallocTemplate

Holds the buffer's deallocation code

name

Canonical name that this buffer is registered as in the NetworkContext

shape

Represents the dimensions of the underlying tensor as a sequence of dimension sizes

sizeInBytes() int

Returns the size of this VariableBuffer in bytes

Returns:

Size of this VariableBuffer in bytes

Return type:

int

alloc() str

Return a string representation of the C code required to allocated this memory buffer

Returns:

C Code to allocate this buffer

Return type:

str

dealloc() str

Return a string representation of the C code to deallocate/free this memory buffer at runtime

Returns:

C Code to free this buffer

Return type:

str

has_live_aliases(ctxt: NetworkContext) bool

Checks whether this VariableBuffer has any live ancestors, i.e. buffers that are still live and are aliased by this buffer. :param ctxt: Current NetworkContext :type ctxt: NetworkContext

Returns:

True if this VariableBuffer has any live ancestors, False otherwise

Return type:

bool

init() str

Return a string representation of the C code to declare this memory buffer

Returns:

C Code to declare this buffer

Return type:

str

initTemplate: NodeTemplate

Holds the buffer’s initialization code

Type:

NodeTemplate

allocTemplate: NodeTemplate

Holds the buffer’s allocation code

Type:

NodeTemplate

deallocTemplate: NodeTemplate

Holds the buffer’s deallocation code

Type:

NodeTemplate

name: str

Canonical name that this buffer is registered as in the NetworkContext

Type:

str

shape: Sequence[int]

Represents the dimensions of the underlying tensor as a sequence of dimension sizes

Type:

Sequence[int]