// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #pragma once #include "TensorFeatureDescriptor.h" namespace _winml { // We need to define our own type for Half since DirectX::PackedVector::Half resolves to uint16_t per its typedef declaration. // Templates require an actual type name to resolve correctly. struct Half { DirectX::PackedVector::HALF value; }; template struct TensorKindFrom {}; template <> struct TensorKindFrom { static const winml::TensorKind Type = winml::TensorKind::Int8; }; template <> struct TensorKindFrom { static const winml::TensorKind Type = winml::TensorKind::UInt8; }; template <> struct TensorKindFrom { static const winml::TensorKind Type = winml::TensorKind::UInt16; }; template <> struct TensorKindFrom { static const winml::TensorKind Type = winml::TensorKind::Int16; }; template <> struct TensorKindFrom { static const winml::TensorKind Type = winml::TensorKind::UInt32; }; template <> struct TensorKindFrom { static const winml::TensorKind Type = winml::TensorKind::Int32; }; template <> struct TensorKindFrom { static const winml::TensorKind Type = winml::TensorKind::UInt64; }; template <> struct TensorKindFrom { static const winml::TensorKind Type = winml::TensorKind::Int64; }; template <> struct TensorKindFrom { static const winml::TensorKind Type = winml::TensorKind::Boolean; }; template <> struct TensorKindFrom { static const winml::TensorKind Type = winml::TensorKind::Double; }; template <> struct TensorKindFrom { static const winml::TensorKind Type = winml::TensorKind::Float; }; template <> struct TensorKindFrom { static const winml::TensorKind Type = winml::TensorKind::Float16; }; template <> struct TensorKindFrom { static const winml::TensorKind Type = winml::TensorKind::String; }; template <> struct TensorKindFrom { static const winml::TensorKind Type = winml::TensorKind::Int8; }; template <> struct TensorKindFrom { static const winml::TensorKind Type = winml::TensorKind::UInt8; }; template <> struct TensorKindFrom { static const winml::TensorKind Type = winml::TensorKind::UInt16; }; template <> struct TensorKindFrom { static const winml::TensorKind Type = winml::TensorKind::Int16; }; template <> struct TensorKindFrom { static const winml::TensorKind Type = winml::TensorKind::UInt32; }; template <> struct TensorKindFrom { static const winml::TensorKind Type = winml::TensorKind::Int32; }; template <> struct TensorKindFrom { static const winml::TensorKind Type = winml::TensorKind::UInt64; }; template <> struct TensorKindFrom { static const winml::TensorKind Type = winml::TensorKind::Int64; }; template <> struct TensorKindFrom { static const winml::TensorKind Type = winml::TensorKind::Boolean; }; template <> struct TensorKindFrom { static const winml::TensorKind Type = winml::TensorKind::Double; }; template <> struct TensorKindFrom { static const winml::TensorKind Type = winml::TensorKind::Float; }; template <> struct TensorKindFrom { static const winml::TensorKind Type = winml::TensorKind::String; }; template <> struct TensorKindFrom { static const winml::TensorKind Type = winml::TensorKind::String; }; template <> struct TensorKindFrom { static const winml::TensorKind Type = winml::TensorKind::Float16; }; template struct TensorFeatureDescriptorFrom { static winml::ILearningModelFeatureDescriptor CreateAnonymous(std::vector shape) { return winrt::make( nullptr /* set to null as values are name-less */, nullptr /* set to null as values are description-less */, TensorKindFrom::Type, shape, false /* set to false as values dont have required annotations */, false /* set to false as this is not a tensor of unsupported metadata */ ); } }; } // namespace _winml