InferenceTensorTile<TLogic extends Logic, TValue> constructor

InferenceTensorTile<TLogic extends Logic, TValue>({
  1. required int rowCount,
  2. required int columnCount,
  3. required TypedLogicArrayElementBuilder<TLogic> elementBuilder,
  4. required InferenceNumericFormat format,
  5. LogicValueCodec<TValue>? valueCodec,
  6. TypedLogicArrayElementCompatibility<TLogic>? elementCompatibility,
  7. String name = 'inferenceTensorTile',
  8. int numUnpackedDimensions = 0,
})

Creates a typed tensor tile.

Implementation

factory InferenceTensorTile({
  required int rowCount,
  required int columnCount,
  required TypedLogicArrayElementBuilder<TLogic> elementBuilder,
  required InferenceNumericFormat format,
  LogicValueCodec<TValue>? valueCodec,
  TypedLogicArrayElementCompatibility<TLogic>? elementCompatibility,
  String name = 'inferenceTensorTile',
  int numUnpackedDimensions = 0,
}) {
  if (rowCount < 1 || columnCount < 1) {
    throw ArgumentError('Tensor tile dimensions must be positive.');
  }
  final data = TypedLogicArray<TLogic, TValue>(
    [rowCount, columnCount],
    elementBuilder,
    valueCodec: valueCodec,
    elementCompatibility: elementCompatibility,
    name: 'data',
    numUnpackedDimensions: numUnpackedDimensions,
  );
  if (data.elementWidth != format.elementWidth) {
    throw ArgumentError(
      'Tensor element width ${data.elementWidth} does not match numeric '
      'format width ${format.elementWidth}.',
    );
  }
  return InferenceTensorTile<TLogic, TValue>.fromData(
    data: data,
    format: format,
    name: name,
  );
}