用法
take_while(
predicate, name=None
)参数
-
predicate将张量的嵌套结构(具有由self.output_shapes和self.output_types定义的形状和类型)映射到标量tf.bool张量的函数。 -
name(可选。) tf.data 操作的名称。
返回
-
一个
Dataset。
基于 predicate 停止数据集迭代的转换。
dataset = tf.data.Dataset.range(10)
dataset = dataset.take_while(lambda x:x < 5)
list(dataset.as_numpy_iterator())
[0, 1, 2, 3, 4]
相关用法
- Python tf.compat.v1.data.TextLineDataset.take用法及代码示例
- Python tf.compat.v1.data.TextLineDataset.from_tensors用法及代码示例
- Python tf.compat.v1.data.TextLineDataset.filter用法及代码示例
- Python tf.compat.v1.data.TextLineDataset.skip用法及代码示例
- Python tf.compat.v1.data.TextLineDataset.bucket_by_sequence_length用法及代码示例
- Python tf.compat.v1.data.TextLineDataset.sample_from_datasets用法及代码示例
- Python tf.compat.v1.data.TextLineDataset.cardinality用法及代码示例
- Python tf.compat.v1.data.TextLineDataset.as_numpy_iterator用法及代码示例
- Python tf.compat.v1.data.TextLineDataset.zip用法及代码示例
- Python tf.compat.v1.data.TextLineDataset.unbatch用法及代码示例
- Python tf.compat.v1.data.TextLineDataset.with_options用法及代码示例
- Python tf.compat.v1.data.TextLineDataset.random用法及代码示例
- Python tf.compat.v1.data.TextLineDataset.reduce用法及代码示例
- Python tf.compat.v1.data.TextLineDataset.from_generator用法及代码示例
- Python tf.compat.v1.data.TextLineDataset.snapshot用法及代码示例
- Python tf.compat.v1.data.TextLineDataset.cache用法及代码示例
- Python tf.compat.v1.data.TextLineDataset.range用法及代码示例
- Python tf.compat.v1.data.TextLineDataset.rejection_resample用法及代码示例
- Python tf.compat.v1.data.TextLineDataset.unique用法及代码示例
- Python tf.compat.v1.data.TextLineDataset.shard用法及代码示例
注:本文由纯净天空筛选整理自tensorflow.org大神的英文原创作品 tf.compat.v1.data.TextLineDataset.take_while。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
