pymllm.ffi

Submodules

Attributes

Classes

Functions

echo(rec)

initialize_context()

shutdown_context()

float32_()

float16_()

bfloat16_()

cpu_()

cuda_()

qnn_()

device(device_type)

empty(shape[, dtype, device_type])

zeros(shape[, dtype, device_type])

ones(shape[, dtype, device_type])

arange(start, end[, step, dtype, device_type])

random(shape[, start, end, dtype, device_type])

is_torch_available()

is_numpy_available()

from_torch(torch_tensor)

from_numpy(numpy_tensor)

Package Contents

pymllm.ffi.MLLM_FIND_TORCH_AVAILABLE
pymllm.ffi.MLLM_FIND_NUMPY_AVAILABLE
pymllm.ffi.echo(rec)
Parameters:

rec (str)

Return type:

None

pymllm.ffi.initialize_context()
Return type:

None

pymllm.ffi.shutdown_context()
Return type:

None

class pymllm.ffi.Device

Bases: tvm_ffi.Object

to_pod()
Return type:

int

class pymllm.ffi.DType

Bases: tvm_ffi.Object

to_pod()
Return type:

int

pymllm.ffi.float32_()
Return type:

DType

pymllm.ffi.float16_()
Return type:

DType

pymllm.ffi.bfloat16_()
Return type:

DType

pymllm.ffi.cpu_()
Return type:

Device

pymllm.ffi.cuda_()
Return type:

Device

pymllm.ffi.qnn_()
Return type:

Device

class pymllm.ffi.Tensor

Bases: tvm_ffi.Object

__str__()
Return type:

str

property shape: tvm_ffi.Shape
Return type:

tvm_ffi.Shape

property dtype: DType
Return type:

DType

property device: Device
Return type:

Device

tobytes()
Return type:

tvm_ffi.Array

__add__(other)
Return type:

Tensor

__sub__(other)
__mul__(other)
Return type:

Tensor

__div__(other)
Return type:

Tensor

__neg__(other)
Return type:

Tensor

abs()
Return type:

Tensor

clip(min_val, max_val)
Parameters:
  • min_val (float)

  • max_val (float)

Return type:

Tensor

min(dim=-1, keep_dim=False)
Parameters:
  • dim (int)

  • keep_dim (bool)

Return type:

Tensor

max(dim=-1, keep_dim=False)
Parameters:
  • dim (int)

  • keep_dim (bool)

Return type:

Tensor

sum(dim=-1, keep_dim=False)
Parameters:
  • dim (int)

  • keep_dim (bool)

Return type:

Tensor

mean(dim=-1, keep_dim=False)
Parameters:
  • dim (int)

  • keep_dim (bool)

Return type:

Tensor

transpose(dim0, dim1)
Parameters:
  • dim0 (int)

  • dim1 (int)

Return type:

Tensor

property T: Tensor
Return type:

Tensor

view(shape)
Return type:

Tensor

unsqueeze(dim)
Parameters:

dim (int)

Return type:

Tensor

squeeze(dim)
Parameters:

dim (int)

Return type:

Tensor

permute(dims)
Return type:

Tensor

contiguous()
Return type:

Tensor

clone()
Return type:

Tensor

repeat(multiplier, dim)
Return type:

Tensor

to(dd)
Parameters:

dd (Union[Device, DType])

Return type:

Tensor

cpu()
Return type:

Tensor

cuda()
Return type:

Tensor

property name
set_name(name)
numel()
property rank
is_contiguous()
pymllm.ffi.float32: DType
pymllm.ffi.float16: DType
pymllm.ffi.bfloat16: DType
pymllm.ffi.cpu: Device
pymllm.ffi.cuda: Device
pymllm.ffi.qnn: Device
pymllm.ffi.device(device_type)
Parameters:

device_type (str)

Return type:

Device

pymllm.ffi.empty(shape, dtype=float32, device_type=cpu)
Parameters:
  • shape (tvm_ffi.Shape)

  • dtype (DType)

  • device_type (Union[Device, str])

Return type:

Tensor

pymllm.ffi.zeros(shape, dtype=float32, device_type=cpu)
Parameters:
  • shape (tvm_ffi.Shape)

  • dtype (DType)

  • device_type (Union[Device, str])

Return type:

Tensor

pymllm.ffi.ones(shape, dtype=float32, device_type=cpu)
Parameters:
  • shape (tvm_ffi.Shape)

  • dtype (DType)

  • device_type (Union[Device, str])

Return type:

Tensor

pymllm.ffi.arange(start, end, step=1, dtype=float32, device_type=cpu)
Parameters:
  • start (float)

  • end (float)

  • step (float)

  • dtype (DType)

  • device_type (Union[Device, str])

Return type:

Tensor

pymllm.ffi.random(shape, start=-1.0, end=1.0, dtype=float32, device_type=cpu)
Parameters:
  • shape (tvm_ffi.Shape)

  • start (float)

  • end (float)

  • dtype (DType)

  • device_type (Union[Device, str])

Return type:

Tensor

pymllm.ffi.is_torch_available()
Return type:

bool

pymllm.ffi.is_numpy_available()
Return type:

bool

pymllm.ffi.from_torch(torch_tensor)
pymllm.ffi.from_numpy(numpy_tensor)
class pymllm.ffi.Session

Bases: tvm_ffi.Object