| 299 | } |
| 300 | |
| 301 | void InterleaveDatasetOp::MakeDataset(OpKernelContext* ctx, DatasetBase* input, |
| 302 | DatasetBase** output) { |
| 303 | int64 cycle_length = 0; |
| 304 | OP_REQUIRES_OK(ctx, ParseScalarArgument(ctx, kCycleLength, &cycle_length)); |
| 305 | if (cycle_length == model::kAutotune) { |
| 306 | cycle_length = port::MaxParallelism(); |
| 307 | } |
| 308 | OP_REQUIRES( |
| 309 | ctx, cycle_length > 0, |
| 310 | errors::InvalidArgument("cycle_length must be greater than zero.")); |
| 311 | |
| 312 | int64 block_length = 0; |
| 313 | OP_REQUIRES_OK(ctx, ParseScalarArgument(ctx, kBlockLength, &block_length)); |
| 314 | OP_REQUIRES( |
| 315 | ctx, block_length > 0, |
| 316 | errors::InvalidArgument("block_length must be greater than zero.")); |
| 317 | |
| 318 | std::unique_ptr<CapturedFunction> captured_func; |
| 319 | OP_REQUIRES_OK(ctx, |
| 320 | CapturedFunction::Create(ctx, func_metadata_, kOtherArguments, |
| 321 | &captured_func)); |
| 322 | |
| 323 | *output = new Dataset(ctx, input, std::move(captured_func), cycle_length, |
| 324 | block_length, output_types_, output_shapes_); |
| 325 | } |
| 326 | |
| 327 | namespace { |
| 328 | REGISTER_KERNEL_BUILDER(Name("InterleaveDataset").Device(DEVICE_CPU), |
nothing calls this directly
no test coverage detected