Tensorflow type#

class flytekit.extras.tensorflow.TensorFlowRecordFileTransformer#

TypeTransformer that supports serialising and deserialising to and from TFRecord file. https://www.tensorflow.org/tutorials/load_data/tfrecord

get_literal_type(t)#

Converts the python type to a Flyte LiteralType

Parameters:

t (Type[_SpecificFormatClass])

Return type:

LiteralType

guess_python_type(literal_type)#

Converts the Flyte LiteralType to a python object type.

Parameters:

literal_type (LiteralType)

Return type:

Type[_SpecificFormatClass]

to_literal(ctx, python_val, python_type, expected)#

Converts a given python_val to a Flyte Literal, assuming the given python_val matches the declared python_type. Implementers should refrain from using type(python_val) instead rely on the passed in python_type. If these do not match (or are not allowed) the Transformer implementer should raise an AssertionError, clearly stating what was the mismatch :param ctx: A FlyteContext, useful in accessing the filesystem and other attributes :param python_val: The actual value to be transformed :param python_type: The assumed type of the value (this matches the declared type on the function) :param expected: Expected Literal Type

Parameters:
  • ctx (FlyteContext)

  • python_val (_SpecificFormatClass)

  • python_type (Type[_SpecificFormatClass])

  • expected (LiteralType)

Return type:

Literal

to_python_value(ctx, lv, expected_python_type)#

Converts the given Literal to a Python Type. If the conversion cannot be done an AssertionError should be raised :param ctx: FlyteContext :param lv: The received literal Value :param expected_python_type: Expected native python type that should be returned

Parameters:
Return type:

TFRecordDatasetV2

class flytekit.extras.tensorflow.TensorFlowRecordsDirTransformer#

TypeTransformer that supports serialising and deserialising to and from TFRecord directory. https://www.tensorflow.org/tutorials/load_data/tfrecord

get_literal_type(t)#

Converts the python type to a Flyte LiteralType

Parameters:

t (Type[_SpecificFormatDirectoryClass])

Return type:

LiteralType

guess_python_type(literal_type)#

Converts the Flyte LiteralType to a python object type.

Parameters:

literal_type (LiteralType)

Return type:

Type[_SpecificFormatDirectoryClass]

to_literal(ctx, python_val, python_type, expected)#

Converts a given python_val to a Flyte Literal, assuming the given python_val matches the declared python_type. Implementers should refrain from using type(python_val) instead rely on the passed in python_type. If these do not match (or are not allowed) the Transformer implementer should raise an AssertionError, clearly stating what was the mismatch :param ctx: A FlyteContext, useful in accessing the filesystem and other attributes :param python_val: The actual value to be transformed :param python_type: The assumed type of the value (this matches the declared type on the function) :param expected: Expected Literal Type

Parameters:
  • ctx (FlyteContext)

  • python_val (_SpecificFormatDirectoryClass)

  • python_type (Type[_SpecificFormatDirectoryClass])

  • expected (LiteralType)

Return type:

Literal

to_python_value(ctx, lv, expected_python_type)#

Converts the given Literal to a Python Type. If the conversion cannot be done an AssertionError should be raised :param ctx: FlyteContext :param lv: The received literal Value :param expected_python_type: Expected native python type that should be returned

Parameters:
Return type:

TFRecordDatasetV2