Skip to content

A small collection of utility scripts and extensions for Unity Sentis

License

Notifications You must be signed in to change notification settings

erlapso/com.doji.sentis-utils

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 

Repository files navigation

doji logo

Sentis Utils

A small collection of utility scripts and extensions for Unity Sentis

OpenUPM

About

  • Brings back an Ops class similar to what was available in previous Sentis versions. Unlike with the IBackend class it has the convenience of not needing to figure out the shape and allocate the output tensor when doing operations. In terms of memory management it will not reuse any memory and the consumer is responsible to call Flush() to free the memory of all the temporary tensors.

  • It also includes some more operations that are either not implemented in Sentis or could do with an API that is more convenient or more pytorch-like for easier porting of pytorch-based pre-/postprocessing code.

    • Quantile()
    • Sort()
    • Concatenate() as an alias for Concat()
    • overloads for Concatenate that take individual Tensors instead of arrays (e.g. Concat(t1, t1))
    • RepeatInterleaved (although not implemented for all shapes yet)
    • Split() that matches the arguments of numpy.split or torch.chunk (i.e. providing a sections parameter rather than requiring start & end parameter). It also takes a preallocated list to store the resulting chunks in.
    • SplitHalf(): returns the two output tensors as a tuple.
    • python-like slicing operators: Overloads for the Slice() method that use C# indices and ranges rather than ReadOnlySpan. When you would do tensor[:, -1, :] with a pytorch tensor you can now do ops.Slice(tensor, .., ^1, ..)

Some not-so-great aspects:

  • need to use Reflection to access the internal TensorShape.Split() method to get the shape when splitting tensors

Used by

About

A small collection of utility scripts and extensions for Unity Sentis

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%