Skip to content

formatter

BufferizedNDArrayFormatter

Bases: MonoLogicFormatter

Source code in src/finch/autoschedule/formatter/formatter.py
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
class BufferizedNDArrayFormatter(MonoLogicFormatter):
    def get_tensor_ftype(self, fill_value: AbstractFill, shape_type: tuple[FType, ...]):
        """
        Return the FType of the output tensor produced within the
        autoscheduler.
        """
        fill_ftype = ftype(
            fill_value.dtype if isinstance(fill_value, np.ndarray) else fill_value
        )
        return BufferizedNDArrayFType(
            buffer_type=NumpyBufferFType(fill_ftype),
            ndim=len(shape_type),
            dimension_type=TupleFType.from_tuple(shape_type),
            fill_value=fill_value,
        )

get_tensor_ftype(fill_value, shape_type)

Return the FType of the output tensor produced within the autoscheduler.

Source code in src/finch/autoschedule/formatter/formatter.py
85
86
87
88
89
90
91
92
93
94
95
96
97
98
def get_tensor_ftype(self, fill_value: AbstractFill, shape_type: tuple[FType, ...]):
    """
    Return the FType of the output tensor produced within the
    autoscheduler.
    """
    fill_ftype = ftype(
        fill_value.dtype if isinstance(fill_value, np.ndarray) else fill_value
    )
    return BufferizedNDArrayFType(
        buffer_type=NumpyBufferFType(fill_ftype),
        ndim=len(shape_type),
        dimension_type=TupleFType.from_tuple(shape_type),
        fill_value=fill_value,
    )