318 const std::vector<uint64_t>& shape,
319 T default_value = T {},
323 auto dims = create_dimensions(modality, shape, layout);
324 auto variants = create_variants(modality, shape, default_value, strategy);
326 return { std::move(variants), std::move(dims) };
419 const std::vector<uint64_t>& shape,
423 std::vector<DataVariant> variants;
425 if (org == OrganizationStrategy::INTERLEAVED) {
426 uint64_t total = std::accumulate(shape.begin(), shape.end(), uint64_t(1), std::multiplies<>());
427 variants.emplace_back(std::vector<T>(total, default_value));
432 case DataModality::AUDIO_1D:
433 variants.emplace_back(std::vector<T>(shape[0], default_value));
436 case DataModality::AUDIO_MULTICHANNEL: {
437 uint64_t samples = shape[0];
438 uint64_t channels = shape[1];
439 variants.reserve(channels);
440 for (uint64_t ch = 0; ch < channels; ++ch) {
441 variants.emplace_back(std::vector<T>(samples, default_value));
446 case DataModality::IMAGE_2D:
447 variants.emplace_back(std::vector<T>(shape[0] * shape[1], default_value));
450 case DataModality::IMAGE_COLOR: {
451 uint64_t height = shape[0];
452 uint64_t
width = shape[1];
453 uint64_t channels = shape[2];
455 variants.reserve(channels);
456 for (uint64_t ch = 0; ch < channels; ++ch) {
457 variants.emplace_back(std::vector<T>(
pixels, default_value));
462 case DataModality::SPECTRAL_2D:
463 variants.emplace_back(std::vector<T>(shape[0] * shape[1], default_value));
466 case DataModality::VOLUMETRIC_3D:
467 variants.emplace_back(std::vector<T>(shape[0] * shape[1] * shape[2], default_value));
470 case DataModality::VIDEO_GRAYSCALE: {
471 uint64_t frames = shape[0];
472 uint64_t height = shape[1];
473 uint64_t
width = shape[2];
474 uint64_t frame_size = height *
width;
475 variants.reserve(frames);
476 for (uint64_t f = 0; f < frames; ++f) {
477 variants.emplace_back(std::vector<T>(frame_size, default_value));
482 case DataModality::VIDEO_COLOR: {
483 uint64_t frames = shape[0];
484 uint64_t height = shape[1];
485 uint64_t
width = shape[2];
486 uint64_t channels = shape[3];
487 uint64_t frame_size = height *
width;
488 variants.reserve(frames * channels);
489 for (uint64_t f = 0; f < frames; ++f) {
490 for (uint64_t ch = 0; ch < channels; ++ch) {
491 variants.emplace_back(std::vector<T>(frame_size, default_value));
498 uint64_t total = std::accumulate(shape.begin(), shape.end(), uint64_t(1), std::multiplies<>());
499 variants.emplace_back(std::vector<T>(total, default_value));