nki.language.ndarray#
- nki.language.ndarray(shape, dtype, buffer=None, name='')[source]#
Create a new tensor of given shape and dtype on the specified buffer.
((Similar to numpy.ndarray))
- Parameters:
shape – the shape of the tensor.
dtype – the data type of the tensor (see Supported Data Types for more information).
buffer – the specific buffer (ie, sbuf, psum, hbm), defaults to sbuf.
name – the name of the tensor. The
nameparameter has to be unique for tensors on each Physical NeuronCore(PNC) within each Logical NeuronCore(LNC). It is optional for SRAM tensors, IO tensors, and any HBM tensors that are only visible to one Physical NeuronCore. Forshared_hbmtensors that are not used as kernel inputs or outputs,namemust be specified. In addition, the compiler uses thenameto link non-IOshared_hbmtensors among PNCs. In other word,shared_hbmtensors will point to the same underlying memory as long as they have the same name, even if the tensors appear in different control flow.
- Returns:
a new tensor allocated on the buffer.