model_card_toolkit.BaseModelCardField
Stay organized with collections
Save and categorize content based on your preferences.
Model card field base class.
This is an abstract class. All the model card fields should inherit this class
and override the _proto_type property to the corresponding proto type. This
abstract class provides methods copy_from_proto
, merge_from_proto
and
to_proto
to convert the class from and to proto. The child class does not
need to override this unless it needs some special process.
Methods
clear
View source
clear()
Clear the subfields of this BaseModelCardField.
copy_from_proto
View source
copy_from_proto(
proto: message.Message
) -> 'BaseModelCardField'
Copies the contents of the model card proto into current object.
merge_from_proto
View source
merge_from_proto(
proto: message.Message
) -> 'BaseModelCardField'
Merges the contents of the model card proto into current object.
to_dict
View source
to_dict() -> Dict[str, Any]
Convert your model card to a python dictionary.
to_json
View source
to_json() -> str
Convert this class object to json.
to_proto
View source
to_proto() -> message.Message
Convert this class object to the proto.
__len__
View source
__len__() -> int
Returns the number of items in a field.
Ignores None values recursively,
so the length of a field that only contains another field that has all None
values would be 0.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-04-21 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-04-21 UTC."],[],[],null,["# model_card_toolkit.BaseModelCardField\n\n\u003cbr /\u003e\n\n|--------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/model-card-toolkit/blob/v2.0.0/model_card_toolkit/base_model_card_field.py#L30-L186) |\n\nModel card field base class.\n\nThis is an abstract class. All the model card fields should inherit this class\nand override the _proto_type property to the corresponding proto type. This\nabstract class provides methods `copy_from_proto`, `merge_from_proto` and\n`to_proto` to convert the class from and to proto. The child class does not\nneed to override this unless it needs some special process.\n\nMethods\n-------\n\n### `clear`\n\n[View source](https://github.com/tensorflow/model-card-toolkit/blob/v2.0.0/model_card_toolkit/base_model_card_field.py#L174-L182) \n\n clear()\n\nClear the subfields of this BaseModelCardField.\n\n### `copy_from_proto`\n\n[View source](https://github.com/tensorflow/model-card-toolkit/blob/v2.0.0/model_card_toolkit/base_model_card_field.py#L129-L132) \n\n copy_from_proto(\n proto: message.Message\n ) -\u003e 'BaseModelCardField'\n\nCopies the contents of the model card proto into current object.\n\n### `merge_from_proto`\n\n[View source](https://github.com/tensorflow/model-card-toolkit/blob/v2.0.0/model_card_toolkit/base_model_card_field.py#L122-L127) \n\n merge_from_proto(\n proto: message.Message\n ) -\u003e 'BaseModelCardField'\n\nMerges the contents of the model card proto into current object.\n\n### `to_dict`\n\n[View source](https://github.com/tensorflow/model-card-toolkit/blob/v2.0.0/model_card_toolkit/base_model_card_field.py#L168-L172) \n\n to_dict() -\u003e Dict[str, Any]\n\nConvert your model card to a python dictionary.\n\n### `to_json`\n\n[View source](https://github.com/tensorflow/model-card-toolkit/blob/v2.0.0/model_card_toolkit/base_model_card_field.py#L164-L166) \n\n to_json() -\u003e str\n\nConvert this class object to json.\n\n### `to_proto`\n\n[View source](https://github.com/tensorflow/model-card-toolkit/blob/v2.0.0/model_card_toolkit/base_model_card_field.py#L51-L81) \n\n to_proto() -\u003e message.Message\n\nConvert this class object to the proto.\n\n### `__len__`\n\n[View source](https://github.com/tensorflow/model-card-toolkit/blob/v2.0.0/model_card_toolkit/base_model_card_field.py#L39-L44) \n\n __len__() -\u003e int\n\nReturns the number of items in a field.\nIgnores None values recursively,\nso the length of a field that only contains another field that has all None\nvalues would be 0."]]