简单3 层神经网络Mnist数据集的推理实现
import os, sys
import numpy as np
base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(base_dir)
from dataset.mnist import load_mnist
import pickle
def sigmoid(x):
return 1 / (1 + np.exp(-x))
def softmax(x):
if x.ndim == 2:
x = x.<