Deeploy.DeeployTypes.ConstantBuffer
- class Deeploy.DeeployTypes.ConstantBuffer(name: str = '', shape=[1], values=[0])
Bases:
VariableBuffer
Class to represent compile-time constant tensors (weights, biases, other parameters) within Deeploy.
Methods
- __init__(name: str = '', shape=[1], values=[0])
__init__
([name, shape, values])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)fromVariableBuffer
(buffer, values)init
()Return a string representation of the C code to declare this memory buffer
Attributes
Stores the underlying weights in Python-type representation
Holds the buffer's initialization code
Holds the buffer's allocation code
Holds the buffer's deallocation code
Canonical name that this buffer is registered as in the NetworkContext
Represents the dimensions of the underlying tensor as a sequence of dimension sizes
- values
Stores the underlying weights in Python-type representation
- Type:
np.array
- 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
- 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:
- allocTemplate: NodeTemplate
Holds the buffer’s allocation code
- Type:
- deallocTemplate: NodeTemplate
Holds the buffer’s deallocation code
- Type:
- 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]