314 const std::vector<uint64_t>& shape,
315 T default_value = T {},
319 auto dims = create_dimensions(modality, shape, layout);
320 auto variants = create_variants(modality, shape, default_value, strategy);
322 return { std::move(variants), std::move(dims) };
415 const std::vector<uint64_t>& shape,
419 std::vector<DataVariant> variants;
421 if (org == OrganizationStrategy::INTERLEAVED) {
422 uint64_t total = std::accumulate(shape.begin(), shape.end(), uint64_t(1), std::multiplies<>());
423 variants.emplace_back(std::vector<T>(total, default_value));
428 case DataModality::AUDIO_1D:
429 variants.emplace_back(std::vector<T>(shape[0], default_value));
432 case DataModality::AUDIO_MULTICHANNEL: {
433 uint64_t samples = shape[0];
434 uint64_t channels = shape[1];
435 variants.reserve(channels);
436 for (uint64_t ch = 0; ch < channels; ++ch) {
437 variants.emplace_back(std::vector<T>(samples, default_value));
442 case DataModality::IMAGE_2D:
443 variants.emplace_back(std::vector<T>(shape[0] * shape[1], default_value));
446 case DataModality::IMAGE_COLOR: {
447 uint64_t height = shape[0];
448 uint64_t width = shape[1];
449 uint64_t channels = shape[2];
450 uint64_t pixels = height * width;
451 variants.reserve(channels);
452 for (uint64_t ch = 0; ch < channels; ++ch) {
453 variants.emplace_back(std::vector<T>(pixels, default_value));
458 case DataModality::SPECTRAL_2D:
459 variants.emplace_back(std::vector<T>(shape[0] * shape[1], default_value));
462 case DataModality::VOLUMETRIC_3D:
463 variants.emplace_back(std::vector<T>(shape[0] * shape[1] * shape[2], default_value));
466 case DataModality::VIDEO_GRAYSCALE: {
467 uint64_t frames = shape[0];
468 uint64_t height = shape[1];
469 uint64_t width = shape[2];
470 uint64_t frame_size = height * width;
471 variants.reserve(frames);
472 for (uint64_t f = 0; f < frames; ++f) {
473 variants.emplace_back(std::vector<T>(frame_size, default_value));
478 case DataModality::VIDEO_COLOR: {
479 uint64_t frames = shape[0];
480 uint64_t height = shape[1];
481 uint64_t width = shape[2];
482 uint64_t channels = shape[3];
483 uint64_t frame_size = height * width;
484 variants.reserve(frames * channels);
485 for (uint64_t f = 0; f < frames; ++f) {
486 for (uint64_t ch = 0; ch < channels; ++ch) {
487 variants.emplace_back(std::vector<T>(frame_size, default_value));
494 uint64_t total = std::accumulate(shape.begin(), shape.end(), uint64_t(1), std::multiplies<>());
495 variants.emplace_back(std::vector<T>(total, default_value));