0.1.55
This commit is contained in:
parent
f96bc0da4e
commit
5c1bad3589
@ -1,7 +1,7 @@
|
||||
[metadata]
|
||||
# replace with your username:
|
||||
name = guan
|
||||
version = 0.1.54
|
||||
version = 0.1.55
|
||||
author = guanjihuan
|
||||
author_email = guanjihuan@163.com
|
||||
description = An open source python package
|
||||
|
@ -1,6 +1,6 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: guan
|
||||
Version: 0.1.54
|
||||
Version: 0.1.55
|
||||
Summary: An open source python package
|
||||
Home-page: https://py.guanjihuan.com
|
||||
Author: guanjihuan
|
||||
|
@ -1,10 +1,12 @@
|
||||
# Module: machine_learning
|
||||
import guan
|
||||
model_class = None # 把类定义成全局的,防止保存完整模型时,无法访问函数中的类
|
||||
|
||||
# 全连接神经网络模型(包含一个隐藏层)
|
||||
@guan.function_decorator
|
||||
def fully_connected_neural_network_with_one_hidden_layer(input_size=1, hidden_size=10, output_size=1, activation='relu'):
|
||||
import torch
|
||||
global model_class
|
||||
class model_class(torch.nn.Module):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
@ -30,6 +32,7 @@ def fully_connected_neural_network_with_one_hidden_layer(input_size=1, hidden_si
|
||||
@guan.function_decorator
|
||||
def fully_connected_neural_network_with_two_hidden_layers(input_size=1, hidden_size_1=10, hidden_size_2=10, output_size=1, activation_1='relu', activation_2='relu'):
|
||||
import torch
|
||||
global model_class
|
||||
class model_class(torch.nn.Module):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
@ -68,6 +71,7 @@ def fully_connected_neural_network_with_two_hidden_layers(input_size=1, hidden_s
|
||||
@guan.function_decorator
|
||||
def fully_connected_neural_network_with_three_hidden_layers(input_size=1, hidden_size_1=10, hidden_size_2=10, hidden_size_3=10, output_size=1, activation_1='relu', activation_2='relu', activation_3='relu'):
|
||||
import torch
|
||||
global model_class
|
||||
class model_class(torch.nn.Module):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
Loading…
x
Reference in New Issue
Block a user