Skip to content

[WIP] GenericTensor 2.0 API Design #31

Description

@WhiteBlackGoose

Name of the type

For now we will assume it's Tensor. However it's opionated, because it might be useful to avoid calling it the same name as other libs.

Operations

Namespace: GenericTensor.Core.

Interfaces with method Invoke: () -> A

IAdditiveIdentity<A>
IMultiplicativeIdentity<A>

Interfaces with method Invoke: A -> B

INegate<A, B>

Interfaces with method Invoke: A x B -> C

IAdd<A, B, C>
ISubtract<A, B, C>
IMultiply<A, B, C>
IDivide<A, B, C>

Interfaces with method Invoke: A -> bool

IEqualsAdditiveIdentity<A>

Interfaces with method Invoke: A x B -> bool

IAreEqual<A, B>

Interfaces with method Invoke: A -> string

IToString<A>

Interfaces with method Invoke: A -> byte[]

ISerialize<A>

Interfaces with method Invoke: byte[] -> A

IDeserialize<A>

Tensor

The main type where all these methods will be is Tensor (but not Tensor<T>!).

Composition

static Tensor<T> Concat<T>(params Tensor<T>[] ts, int axis = -1);
byte[] Serialize<T, TSerializer>() where TSerializer : ISerialize<T>;
Tensor<T> Slice<T>(params Either<int, Index, Range>[] dims);
static Tensor<T> Stack<T>(params Tensor<T>[] ts);
Tensor<T> Transpose<T>(Tensor<T> a);
Tensor<T> Transpose<T>(Tensor<T> a, int axis1, int axis2);
void TransposeInplace(Tensor<T> a);
void TransposeInplace(Tensor<T> a, int axis1, int axis2);

Math operations

...

Elementwise:

void AddPointwise<A, B, C, TAdder>(Tensor<A> a, Tensor<B> b, Tensor<C> destination) where TAdder : struct, IAdder<A, B, C>;
Tensor<C> AddPointwise<A, B, C, TAdder>(Tensor<A> a, Tensor<B> b) where TAdder : struct, IAdder<A, B, C>;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions