syna.functions.function module¶
- class syna.functions.function.BroadcastTo(shape: Tuple[int, ...])[source]¶
Bases:
Function
Broadcast x to shape.
- class syna.functions.function.GetItem(slices)[source]¶
Bases:
Function
Supports x[slices] and produces gradient via GetItemGrad.
- class syna.functions.function.GetItemGrad(slices, in_shape)[source]¶
Bases:
Function
Gradient for getitem: scatters gy back into the original shape.
- class syna.functions.function.Reshape(shape: Tuple[int, ...])[source]¶
Bases:
Function
Reshape tensor to a given shape.
- class syna.functions.function.Sum(axis, keepdims)[source]¶
Bases:
Function
Sum reduction, supports axis and keepdims.
- class syna.functions.function.SumTo(shape: Tuple[int, ...])[source]¶
Bases:
Function
Sum elements to target shape (inverse of broadcast_to).
- class syna.functions.function.Transpose(axes=None)[source]¶
Bases:
Function
Transpose with optional axes permutation.
- syna.functions.function.broadcast_to(x, shape: Tuple[int, ...]) Tensor [source]¶
Broadcast x to the given shape.
- syna.functions.function.dropout(x, dropout_ratio=0.5) Tensor [source]¶
Dropout during training; identity during evaluation.
- syna.functions.function.expand_dims(x, axis: int) Tensor [source]¶
Insert a dimension of size 1 at index axis.
- syna.functions.function.flatten(x) Tensor [source]¶
Flatten all dimensions except the first (batch) dimension.
- syna.functions.function.reshape(x, shape) Tensor [source]¶
Reshape tensor; if shape matches returns as_tensor(x).
- syna.functions.function.sum(x, axis: Tuple[int, ...] | None = None, keepdims=False) Tensor [source]¶
Sum elements along given axes.