wvabrinskas / Neuron

A neural network library for Swift
https://williamvabrinskas.com/Neuron/documentation/neuron/
MIT License
104 stars 6 forks source link

Standardize Axis definitions #42

Closed wvabrinskas closed 1 year ago

wvabrinskas commented 1 year ago

Right now axis definitions for mathematical function on Tensor's are not standardized. They are all over the place.

   +--------+
  /        /|
 /        Z |
+---X----+  |
|        |  |
|   -1   Y  +
|        | /
|        |/
+--------+

Along axis 0 the Tensor of shape AxBxC, where A is the columns, B is the rows, and C is the depth, would perform a mathematical function along the Y axis returning a (Ax1xC) Tensor

Along axis 1 the Tensor of shape AxBxC, where A is the columns, B is the rows, and C is the depth, would perform a mathematical function along the X axis returning a (1xBxC) Tensor

Along axis 2 the Tensor of shape AxBxC, where A is the columns, B is the rows, and C is the depth, would perform a mathematical function along the Z axis returning a (AxBx1) Tensor

Along axis -1 the Tensor of shape AxBxC, where A is the columns, B is the rows, and C is the depth, would perform a mathematical function along the Z axis returning a (1x1x1) Tensor Scalar