Skip to content

Commit 878226b

Browse files
committed
Fix dataset_cardinality for dataset map.
1 parent 8cdb4a7 commit 878226b

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/TensorFlowNET.Core/Data/IDatasetV2.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public interface IDatasetV2 : IEnumerable<(Tensor, Tensor)>
5757

5858
IDatasetV2 map(Func<Tensor, Tensor> map_func,
5959
bool use_inter_op_parallelism = true,
60-
bool preserve_cardinality = false,
60+
bool preserve_cardinality = true,
6161
bool use_legacy_function = false);
6262

6363
IDatasetV2 map(Func<Tensor, (Tensor, Tensor), (Tensor, Tensor)> map_func,

src/TensorFlowNET.Core/Data/MapDataset.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ public MapDataset(IDatasetV2 input_dataset,
2525
variant_tensor = ops.map_dataset(input_dataset.variant_tensor,
2626
func,
2727
output_types,
28-
output_shapes);
28+
output_shapes,
29+
use_inter_op_parallelism: use_inter_op_parallelism,
30+
preserve_cardinality: preserve_cardinality);
2931
}
3032
}
3133
}

test/TensorFlowNET.UnitTest/Dataset/DatasetTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public void Cache()
143143
}
144144
}
145145

146-
[TestMethod, Ignore]
146+
[TestMethod]
147147
public void Cardinality()
148148
{
149149
var dataset = tf.data.Dataset.range(10);

0 commit comments

Comments
 (0)