比较与tf.keras.datasets.fashion_mnist的功能差异

tf.keras.datasets.fashion_mnist

class tf.keras.datasets.fashion_mnist()

更多内容详见tf.keras.datasets.fashion_mnist

mindspore.dataset.FashionMnistDataset

class mindspore.dataset.FashionMnistDataset(
    dataset_dir,
    usage=None,
    num_samples=None,
    num_parallel_workers=None,
    shuffle=None,
    sampler=None,
    num_shards=None,
    shard_id=None,
    cache=None
)

更多内容详见mindspore.dataset.FashionMnistDataset

使用方式

TensorFlow:可使用类内的 load_data 方法下载并加载Fashion MNIST数据集。

MindSpore:从指定路径加载Fashion MNIST数据集文件,并返回数据集对象。

代码示例

# The following implements FashionMnistDataset with MindSpore.
import mindspore.dataset as ds

fashion_mnist_dataset_dir = "/path/to/fashion_mnist_dataset_directory"
dataset = ds.FashionMnistDataset(dataset_dir=fashion_mnist_dataset_dir)

# The following implements fashion_mnist with TensorFlow.
import tensorflow as tf

(x_train, y_train), (x_test, y_test) = tf.keras.datasets.fashion_mnist.load_data()