1# Copyright 2020 Huawei Technologies Co., Ltd 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14# ============================================================================ 15"""test_dataset_utils""" 16import pytest 17 18import mindspore as ms 19from mindspore.train._utils import _construct_tensor_list 20 21 22def test_init_dataset_graph(): 23 types = (ms.float32, ms.float32) 24 shapes = ((1, 3, 224, 224), (32,)) 25 _construct_tensor_list(types, shapes) 26 27 28def test_init_dataset_graph_one_dim(): 29 types = (ms.float32,) 30 shapes = ((1, 3, 224, 224),) 31 _construct_tensor_list(types, shapes) 32 33 34def test_init_dataset_graph_dim_error(): 35 types = (ms.float32, ms.float32) 36 shapes = ((1, 3, 224, 224),) 37 with pytest.raises(ValueError): 38 _construct_tensor_list(types, shapes) 39