import numpy as np

def sigmoid(x):
    """sigmoid
    シグモイド関数
    """
    y = 1 / (1 + np.exp(-x))
    return y

def softmax(x):
    """softmax
    ソフトマックス関数
    """
    c = np.max(x)
    exp_x = np.exp(x - c)
    sum_exp_x = np.sum(exp_x)

    return exp_x / sum_exp_x

@@ -78,11 +78,14 @@
     
-y =
+return
  1 /
@@ -106,22 +106,8 @@
 x))%0D
-%0A    return y%0D
 %0A%0D%0Ad
@@ -170,109 +170,319 @@
     
-c = np.max(x)%0D%0A    exp_x = np.exp(x - c)%0D%0A    sum_exp_x = np.sum(exp_
+if x.ndim == 2:%0D%0A        x = x.T%0D%0A        x = x - np.max(x, axis=0)%0D%0A        y = np.exp(x) / np.sum(np.exp(x), axis=0)%0D%0A        return y.T%0D%0A%0D%0A    x = x - np.max(x)%0D%0A    return np.exp(x) / np.sum(np.exp(x))%0D%0A%0D%0Adef sigmoid_grad(
 x)
+:
 %0D%0A
-%0D%0A    return exp_x / sum_exp_x
+    %22%22%22sigmoid_grad%0D%0A    %E3%82%B7%E3%82%B0%E3%83%A2%E3%82%A4%E3%83%89%E9%96%A2%E6%95%B0%E3%81%AE%E5%8B%BE%E9%85%8D%22%22%22%0D%0A    return (1.0 - sigmoid(x)) * sigmoid(x)
 %0D%0A

fix function.py