# Path: brainforge/util/typing.py
# def scalX(scalar, dtype=floatX):
#     return np.asscalar(np.array([scalar], dtype=dtype))
# 
# def zX_like(array, dtype=floatX):
#     return zX(*array.shape, dtype=dtype)
# 
# Path: brainforge/config/numeric.py



import numpy as np
from ..util.typing import scalX, zX_like
from ..config import floatX
        J = np.ones_like(A)
        J[A <= 0.] = self.alpha
        return J


class SoftMax(ActivationFunction):

    type = "softmax"

    def __init__(self, temperature=1.):
        if temperature != 1.:
            self.temperature = scalX(temperature)
            self.__call__ = self.tn

    def tn(self, Z):
        return self.t1(Z / self.temperature)

    @staticmethod
    def t1(Z) -> np.ndarray:
        eZ = np.exp(Z - Z.max(axis=1, keepdims=True))
        return eZ / np.sum(eZ, axis=1, keepdims=True)

    forward = t1

    def backward(self, A: np.ndarray) -> np.ndarray:
        return s1

    @staticmethod
    def true_backward(A: np.ndarray):
        # TODO: test this with numerical gradient testing!

# Path: brainforge/util/typing.py
# def scalX(scalar, dtype=floatX):
#     return np.asscalar(np.array([scalar], dtype=dtype))
# 
# def zX_like(array, dtype=floatX):
#     return zX(*array.shape, dtype=dtype)
# 
# Path: brainforge/config/numeric.py



# Path: brainforge/atomic/activation_op.py
import numpy as np
from ..util.typing import scalX, zX_like
from ..config import floatX

        J = np.ones_like(A)
        J[A <= 0.] = self.alpha
        return J


class SoftMax(ActivationFunction):

    type = "softmax"

    def __init__(self, temperature=1.):
        if temperature != 1.:
            self.temperature = scalX(temperature)
            self.__call__ = self.tn

    def tn(self, Z):
        return self.t1(Z / self.temperature)

    @staticmethod
    def t1(Z) -> np.ndarray:
        eZ = np.exp(Z - Z.max(axis=1, keepdims=True))
        return eZ / np.sum(eZ, axis=1, keepdims=True)

    forward = t1

    def backward(self, A: np.ndarray) -> np.ndarray:
        return s1

    @staticmethod
    def true_backward(A: np.ndarray):
        # TODO: test this with numerical gradient testing!

        I = np.eye(A.shape[1], dtype=floatX)