Module: NDAV::OrtValue

Defined in:
lib/ndav/ort_value.rb

Defined Under Namespace

Modules: Converter, FromNDAV, MemoryViewable

Constant Summary collapse

TYPE_TO_FORMAT =
{
  int8: "c",
  uint8: "C",
  int16: "s",
  uint16: "S",
  int32: "l",
  uint32: "L",
  int64: "q",
  uint64: "Q",
  float: "f",
  double: "d"
}
FORMAT_TO_TYPE =
::NDAV::ITEM_SIZES.to_h {|format, size|
  suffix = size * 8
  type = case format
         when "s!", "c", "s", "l", "q", "i", "i!", "l!", "q!"
           :"int#{suffix}"
         when "S!", "C", "S", "L", "Q", "I", "I!", "L!", "Q!"
           :"uint#{suffix}"
         when "f"
           :float
         when "d"
           :double
         end
  [format, type]
}
TYPE_SIZES =
TYPE_TO_FORMAT.transform_values {|format| ::NDAV::ITEM_SIZES[format]}