tvm
Loading...
Searching...
No Matches
Namespaces | Classes | Functions
tvm::support Namespace Reference

Namespaces

namespace  base64
 namespace of base64 decoding and encoding table
 

Classes

class  Base64InStream
 Input stream from base64 encoding. More...
 
class  Base64OutStream
 Stream to write to base64 format. More...
 
class  BytesInStream
 Read-only stream over a fixed memory region. More...
 
class  BytesOutStream
 Write-only stream that appends to a caller-provided std::string. More...
 
struct  GPUThreadTag
 The rank and dimension of a physical GPU thread tag. More...
 
class  NVTXScopedRange
 A class to create a NVTX range. No-op if TVM is not built against NVTX. More...
 
class  OrderedMap
 An STL-like map that preserves insertion order. More...
 
struct  Serializer
 Primary Serializer template. Specialize for each serializable type. More...
 
struct  Serializer< DLDataType >
 
struct  Serializer< DLDevice >
 
struct  Serializer< ffi::Array< T > >
 
struct  Serializer< ffi::Bytes >
 
struct  Serializer< ffi::Map< K, V > >
 
struct  Serializer< ffi::String >
 
struct  Serializer< std::pair< A, B > >
 
struct  Serializer< std::string >
 
struct  Serializer< std::unordered_map< K, V > >
 
struct  Serializer< std::vector< T > >
 
struct  Serializer< T, std::enable_if_t< std::is_arithmetic_v< T > > >
 
struct  Serializer< T, std::enable_if_t< std::is_enum_v< T > > >
 
class  Stream
 Abstract binary stream for serialization. More...
 
class  StreamBufferReader
 Buffer reader from stream to avoid virtual call overhead on each read. More...
 

Functions

template<typename T >
T GetEnv (const char *key, T default_value)
 Get environment variable with a typed default value.
 
ffi::String GetFileFormat (const ffi::String &path, const ffi::String &format)
 Get the explicit format, or the extension of the file path.
 
ffi::Bytes ReadBytesFromFile (const ffi::String &path)
 Read a file as binary bytes.
 
void WriteBytesToFile (const ffi::String &path, const ffi::Bytes &data)
 Write binary bytes to a file.
 
std::string StrEscape (const char *data, size_t size, bool use_octal_escape=false, bool escape_whitespace_special_chars=true)
 Create a stream with escape.
 
std::string StrEscape (const std::string &val, bool use_octal_escape=false, bool escape_whitespace_special_chars=true)
 Create a stream with escape.
 

Function Documentation

◆ GetEnv()

template<typename T >
T tvm::support::GetEnv ( const char *  key,
T  default_value 
)
inline

Get environment variable with a typed default value.

Template Parameters
TThe value type (must be arithmetic or std::string).
Parameters
keyThe environment variable name.
default_valueThe value to return if the variable is unset or empty.
Returns
The parsed value or the default.

◆ GetFileFormat()

ffi::String tvm::support::GetFileFormat ( const ffi::String &  path,
const ffi::String &  format 
)
inline

Get the explicit format, or the extension of the file path.

◆ ReadBytesFromFile()

ffi::Bytes tvm::support::ReadBytesFromFile ( const ffi::String &  path)
inline

Read a file as binary bytes.

◆ StrEscape() [1/2]

std::string tvm::support::StrEscape ( const char *  data,
size_t  size,
bool  use_octal_escape = false,
bool  escape_whitespace_special_chars = true 
)
inline

Create a stream with escape.

Parameters
dataThe data
sizeThe size of the string.
use_octal_escapeTrue to use octal escapes instead of hex. If producing C strings, use octal escapes to avoid ambiguously-long hex escapes.
escape_whitespace_special_charsIf True (default), escape any tab, newline, and carriage returns that occur in the string. If False, do not escape these characters.
Returns
the Result string.

◆ StrEscape() [2/2]

std::string tvm::support::StrEscape ( const std::string &  val,
bool  use_octal_escape = false,
bool  escape_whitespace_special_chars = true 
)
inline

Create a stream with escape.

Parameters
valThe C++ string
use_octal_escapeTrue to use octal escapes instead of hex. If producing C strings, use octal escapes to avoid ambiguously-long hex escapes.
escape_whitespace_special_charsIf True (default), escape any tab, newline, and carriage returns that occur in the string. If False, do not escape these characters. If producing python strings with """triple quotes""", do not escape these characters.
Returns
the Result string.

◆ WriteBytesToFile()

void tvm::support::WriteBytesToFile ( const ffi::String &  path,
const ffi::Bytes &  data 
)
inline

Write binary bytes to a file.