CastTransformer#

class CastTransformer[source]#

Bases: RasterTransformer

Casts chips to the specified dtype.

__init__(to_dtype: str)[source]#

Constructor.

Parameters

to_dtype (str) – (str) dtype to cast the chips to.

Methods

__init__(to_dtype)

Constructor.

get_out_channels(in_channels)

Number of channels in output of transform().

get_out_dtype(in_dtype)

dtype of the output of transform().

transform(chip)

Cast chip to dtype self.to_dtype.

__init__(to_dtype: str)[source]#

Constructor.

Parameters

to_dtype (str) – (str) dtype to cast the chips to.

get_out_channels(in_channels: int) int#

Number of channels in output of transform().

Parameters

in_channels (int) –

Return type

int

get_out_dtype(in_dtype: dtype) dtype[source]#

dtype of the output of transform().

Parameters

in_dtype (dtype) –

Return type

dtype

transform(chip: ndarray) ndarray[source]#

Cast chip to dtype self.to_dtype.

Parameters

chip (ndarray) – Array of shape (…, H, W, C).

Returns

Array of shape (…, H, W, C)

Return type

ndarray