当前位置: 首页>>代码示例>>Python>>正文


Python parsing_ops.decode_csv函数代码示例

本文整理汇总了Python中tensorflow.python.ops.parsing_ops.decode_csv函数的典型用法代码示例。如果您正苦于以下问题:Python decode_csv函数的具体用法?Python decode_csv怎么用?Python decode_csv使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了decode_csv函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _test

  def _test(self, args, expected_out=None, expected_err_re=None):
    if expected_err_re is None:
      decode = parsing_ops.decode_csv(**args)
      out = self.evaluate(decode)

      for i, field in enumerate(out):
        if field.dtype == np.float32 or field.dtype == np.float64:
          self.assertAllClose(field, expected_out[i])
        else:
          self.assertAllEqual(field, expected_out[i])
    else:
      with self.assertRaisesOpError(expected_err_re):
        decode = parsing_ops.decode_csv(**args)
        self.evaluate(decode)
开发者ID:HughKu,项目名称:tensorflow,代码行数:14,代码来源:decode_csv_op_test.py

示例2: _apply_transform

 def _apply_transform(self, input_tensors):
   default_consts = [constant_op.constant(d, shape=[1])
                     for d in self._default_values]
   parsed_values = parsing_ops.decode_csv(input_tensors[0],
                                          record_defaults=default_consts)
   # pylint: disable=not-callable
   return self.return_type(*parsed_values)
开发者ID:Baaaaam,项目名称:tensorflow,代码行数:7,代码来源:csv_parser.py

示例3: _make_test_datasets

 def _make_test_datasets(self, inputs, **kwargs):
   # Test by comparing its output to what we could get with map->decode_csv
   filenames = self._setup_files(inputs)
   dataset_expected = core_readers.TextLineDataset(filenames)
   dataset_expected = dataset_expected.map(
       lambda l: parsing_ops.decode_csv(l, **kwargs))
   dataset_actual = readers.CsvDataset(filenames, **kwargs)
   return (dataset_actual, dataset_expected)
开发者ID:Wajih-O,项目名称:tensorflow,代码行数:8,代码来源:csv_dataset_test.py

示例4: benchmarkMapWithStrings

 def benchmarkMapWithStrings(self):
   self._setUp(self.STR_VAL)
   for i in range(len(self._filenames)):
     num_cols = self._num_cols[i]
     kwargs = {'record_defaults': [['']] * num_cols}
     dataset = core_readers.TextLineDataset(self._filenames[i]).repeat()
     dataset = dataset.map(lambda l: parsing_ops.decode_csv(l, **kwargs))  # pylint: disable=cell-var-from-loop
     self._runBenchmark(dataset, num_cols, 'csv_strings_map_decode_csv')
   self._tearDown()
开发者ID:aeverall,项目名称:tensorflow,代码行数:9,代码来源:csv_dataset_benchmark.py

示例5: decode_csv_fn

 def decode_csv_fn(x):
   return parsing_ops.decode_csv(
       x,
       record_defaults=[
           constant_op.constant([], dtypes.float32),
           constant_op.constant([], dtypes.int32),
           constant_op.constant([], dtypes.string)
       ],
       field_delim=":")
开发者ID:kylin9872,项目名称:tensorflow,代码行数:9,代码来源:map_vectorization_test.py


注:本文中的tensorflow.python.ops.parsing_ops.decode_csv函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。