tlc.core.builtins.schemas.schemas

A number of helper classes for common simple schemas

Module Contents

Classes

Class

Description

RedComponentSchema

A schema for a red component (uint8 in range 0-255)

RedComponentListSchema

A schema for a list of red components (uint8 in range 0-255)

GreenComponentSchema

A schema for a green component (uint8 in range 0-255)

GreenComponentListSchema

A schema for a list of green components (uint8 in range 0-255)

BlueComponentSchema

A schema for a blue component (uint8 in range 0-255)

BlueComponentListSchema

A schema for a list of blue components (uint8 in range 0-255)

Float32Schema

A schema for a float32 value

Float32ListSchema

A schema for a list of float32 values

Int32Schema

A schema for an int32 value

Int32ListSchema

A schema for a list of int32 values

BoolSchema

A schema for a boolean value

BoolListSchema

A schema for a list of boolean values

StringSchema

A schema for a string value

StringListSchema

A schema for a list of string values

ImageUrlSchema

A schema for an image URL

XyzSchema

A Schema defining an (x, y, z) value

COCOLabelSchema

A Schema defining COCO label

CIFAR10LabelSchema

A Schema defining CIFAR10 label

CategoricalLabelSchema

A schema for a categorical label

CategoricalLabelListSchema

A schema for a list of categorical labels

FloatVector2Schema

A schema for a 2D vector

FloatVector3Schema

A schema for a 3D vector

ExampleIdSchema

A schema for example ID values

EpochSchema

A schema for epoch values

IterationSchema

A schema for iteration values

ForeignTableIdSchema

A schema describing a value that identifies a foreign table

SampleWeightSchema

A schema for sample weight values

API

class RedComponentSchema(
**kwargs: Any,
)

Bases: tlc.core.schema.Schema

A schema for a red component (uint8 in range 0-255)

class RedComponentListSchema(
**kwargs: Any,
)

Bases: tlc.core.builtins.schemas.schemas.RedComponentSchema

A schema for a list of red components (uint8 in range 0-255)

class GreenComponentSchema(
**kwargs: Any,
)

Bases: tlc.core.schema.Schema

A schema for a green component (uint8 in range 0-255)

class GreenComponentListSchema(
**kwargs: Any,
)

Bases: tlc.core.builtins.schemas.schemas.GreenComponentSchema

A schema for a list of green components (uint8 in range 0-255)

class BlueComponentSchema(
**kwargs: Any,
)

Bases: tlc.core.schema.Schema

A schema for a blue component (uint8 in range 0-255)

class BlueComponentListSchema(
**kwargs: Any,
)

Bases: tlc.core.builtins.schemas.schemas.BlueComponentSchema

A schema for a list of blue components (uint8 in range 0-255)

class Float32Schema(
number_role: str = '',
**kwargs: Any,
)

Bases: tlc.core.schema.Schema

A schema for a float32 value

Parameters:
  • number_role – The role of the float32 value.

  • kwargs – Additional arguments to pass to the Schema constructor

class Float32ListSchema(
list_size: int | None = None,
number_role: str = '',
**kwargs: Any,
)

Bases: tlc.core.builtins.schemas.schemas.Float32Schema

A schema for a list of float32 values

Parameters:
  • list_size – The size of the list, if fixed-size. If None, the list can be of any size.

  • number_role – The role of the number values in the list.

  • kwargs – Additional arguments to pass to the Schema constructor

class Int32Schema(
number_role: str = '',
**kwargs: Any,
)

Bases: tlc.core.schema.Schema

A schema for an int32 value

Parameters:
  • number_role – The role of the int32 value.

  • kwargs – Additional arguments to pass to the Schema constructor

class Int32ListSchema(
list_size: int | None = None,
number_role: str = '',
**kwargs: Any,
)

Bases: tlc.core.builtins.schemas.schemas.Int32Schema

A schema for a list of int32 values

Parameters:
  • list_size – The size of the list, if fixed-size. If None, the list can be of any size.

  • kwargs – Additional arguments to pass to the Schema constructor

class BoolSchema(
**kwargs: Any,
)

Bases: tlc.core.schema.Schema

A schema for a boolean value

Parameters:

kwargs – Additional arguments to pass to the Schema constructor

class BoolListSchema(
list_size: int | None = None,
**kwargs: Any,
)

Bases: tlc.core.builtins.schemas.schemas.BoolSchema

A schema for a list of boolean values

Parameters:
  • list_size – The size of the list, if fixed-size. If None, the list can be of any size.

  • kwargs – Additional arguments to pass to the Schema constructor

class StringSchema(
string_role: str = '',
**kwargs: Any,
)

Bases: tlc.core.schema.Schema

A schema for a string value

Parameters:
  • string_role – The role of the string value.

  • kwargs – Additional arguments to pass to the Schema constructor

class StringListSchema(
list_size: int | None = None,
**kwargs: Any,
)

Bases: tlc.core.builtins.schemas.schemas.StringSchema

A schema for a list of string values

Parameters:
  • list_size – The size of the list, if fixed-size. If None, the list can be of any size.

  • kwargs – Additional arguments to pass to the Schema constructor

class ImageUrlSchema(
**kwargs: Any,
)

Bases: tlc.core.schema.Schema

A schema for an image URL

class XyzSchema(
display_name: str = '',
description: str = '',
writable: bool = True,
display_importance: float = 0,
value_type: str = _DEFAULT_SCALAR_VALUE_TYPE,
)

Bases: tlc.core.schema.Schema

A Schema defining an (x, y, z) value

class COCOLabelSchema(
display_name: str = 'label',
description: str = 'COCO Label',
writable: bool = False,
display_importance: float = 0,
)

Bases: tlc.core.schema.Schema

A Schema defining COCO label

class CIFAR10LabelSchema(
display_name: str = 'label',
description: str = 'CIFAR-10 Label',
writable: bool = False,
display_importance: float = 0,
value_type: str = _DEFAULT_SCALAR_VALUE_TYPE,
)

Bases: tlc.core.schema.Schema

A Schema defining CIFAR10 label

class CategoricalLabelSchema(
class_names: list[str] | None = None,
classes: Sequence[str] | Sequence[dict[str, str]] | Sequence[MapElement] | dict[float, str] | dict[int, str] | dict[float, MapElement] | dict[int, MapElement] | None = None,
**kwargs: Any,
)

Bases: tlc.core.schema.Schema

A schema for a categorical label

Parameters:
  • class_names – Deprecated, use classes instead

  • classes – The classes to use for the label. If a list or sequence, each item will be converted to a MapElement and assigned a zero-based integer key. If a dict, the keys will be used as the label values and the values will be converted to MapElements.

  • kwargs – Additional arguments to pass to the Schema constructor

class CategoricalLabelListSchema(
classes: Sequence[str] | Sequence[dict[str, str]] | Sequence[MapElement] | dict[float, str] | dict[int, str] | dict[float, MapElement] | dict[int, MapElement] | None = None,
class_names: list[str] | None = None,
list_size: int | None = None,
**kwargs: Any,
)

Bases: tlc.core.builtins.schemas.schemas.CategoricalLabelSchema

A schema for a list of categorical labels

Parameters:
  • classes – The classes to use for the label

  • class_names – Deprecated, use classes instead

  • list_size – The size of the list, if fixed-size. If None, the list can be of any size.

  • kwargs – Additional arguments to pass to the Schema constructor

class FloatVector2Schema(
display_name: str = '2D Embedding',
description: str = '',
writable: bool = False,
display_importance: float = 0,
number_role: str = NUMBER_ROLE_XY_COMPONENT,
mode: Literal[numpy, python] = 'python',
)

Bases: tlc.core.schema.Schema

A schema for a 2D vector

class FloatVector3Schema(
display_name: str = '3D Embedding',
description: str = '',
writable: bool = False,
display_importance: float = 0,
number_role: str = NUMBER_ROLE_XYZ_COMPONENT,
mode: Literal[numpy, python] = 'python',
)

Bases: tlc.core.schema.Schema

A schema for a 3D vector

class ExampleIdSchema(
display_name: str = 'Example ID',
description: str = '',
writable: bool = False,
computable: bool = False,
)

Bases: tlc.core.schema.Schema

A schema for example ID values

Example ID is a unique identifier for an example. It is used to identify examples across different tables.

class EpochSchema(
display_name: str = 'Epoch',
description: str = 'Epoch of training',
display_importance: float | None = None,
)

Bases: tlc.core.schema.Schema

A schema for epoch values

class IterationSchema(
display_name: str = 'Iteration',
description: str = 'The current iteration of the training process.',
display_importance: float | None = None,
)

Bases: tlc.core.schema.Schema

A schema for iteration values

class ForeignTableIdSchema(
foreign_table_url: str,
display_name: str = '',
)

Bases: tlc.core.schema.Schema

A schema describing a value that identifies a foreign table

class SampleWeightSchema(
display_name: str = 'Weight',
description: str = 'The weights of the samples in this table.',
sample_type: str = 'hidden',
default_value: float = 1.0,
)

Bases: tlc.core.schema.Schema

A schema for sample weight values

Initialize the SampleWeightSchema

Parameters:
  • display_name – The display name of the schema

  • description – The description of the schema

  • sample_type – The sample type of the schema

  • default_value – The default value of the schema