Function mindspore::dataset::Schema

Function Documentation

inline std::shared_ptr<SchemaObj> mindspore::dataset::Schema(const std::string &schema_file = "")

Function to create a SchemaObj.

Parameters

schema_file[in] Path of schema file (default = “”, which means do not set the path).

Returns

Shared pointer to the current schema.

样例
/* Define a schema to make RandomDataset generate specific data. */
std::shared_ptr<SchemaObj> schema = Schema();
schema->add_column("image", mindspore::DataType::kNumberTypeUInt8, {2});
schema->add_column("label", mindspore::DataType::kNumberTypeUInt8, {1});
std::shared_ptr<Dataset> ds = RandomData(50, schema);