You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_general.py 1.6 kB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # Copyright 2019 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. from util import save_and_check
  16. import mindspore.dataset as ds
  17. from mindspore import log as logger
  18. DATA_DIR = ["../data/dataset/testTFTestAllTypes/test.data"]
  19. SCHEMA_DIR = "../data/dataset/testTFTestAllTypes/datasetSchema.json"
  20. COLUMNS = ["col_1d", "col_2d", "col_3d", "col_binary", "col_float",
  21. "col_sint16", "col_sint32", "col_sint64"]
  22. GENERATE_GOLDEN = False
  23. def test_case_columns_list():
  24. """
  25. a simple repeat operation.
  26. """
  27. logger.info("Test Simple Repeat")
  28. # define parameters
  29. repeat_count = 2
  30. parameters = {"params": {'repeat_count': repeat_count}}
  31. columns_list = ["col_sint64", "col_sint32"]
  32. # apply dataset operations
  33. data1 = ds.TFRecordDataset(DATA_DIR, SCHEMA_DIR, columns_list=columns_list, shuffle=False)
  34. data1 = data1.repeat(repeat_count)
  35. filename = "columns_list_result.npz"
  36. save_and_check(data1, parameters, filename, generate_golden=GENERATE_GOLDEN)