mirror of
https://github.com/wassname/keras-contrib.git
synced 2026-06-27 16:10:11 +08:00
Add activations, regularizers...
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
from __future__ import absolute_import
|
||||
from . import backend
|
||||
from . import datasets
|
||||
from . import layers
|
||||
from . import preprocessing
|
||||
from . import utils
|
||||
from . import wrappers
|
||||
from . import callbacks
|
||||
from . import constraints
|
||||
from . import initializations
|
||||
from . import metrics
|
||||
from . import objectives
|
||||
from . import optimizers
|
||||
from . import regularizers
|
||||
|
||||
__version__ = '0.0.1'
|
||||
@@ -0,0 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from . import backend as K
|
||||
from keras.utils.generic_utils import get_from_module
|
||||
|
||||
from keras.activations import *
|
||||
@@ -0,0 +1,14 @@
|
||||
from keras import backend as K
|
||||
|
||||
# We import all keras backend functions here,
|
||||
# so that files in this repo can import both
|
||||
# core and contrib backend functions with a
|
||||
# single import statement.
|
||||
|
||||
from keras.backend import *
|
||||
|
||||
|
||||
if K.backend() == 'theano':
|
||||
from .theano_backend import *
|
||||
elif K.backend() == 'tensorflow':
|
||||
from .tensorflow_backend import *
|
||||
@@ -0,0 +1,14 @@
|
||||
import tensorflow as tf
|
||||
from tensorflow.python.training import moving_averages
|
||||
from tensorflow.python.ops import tensor_array_ops
|
||||
from tensorflow.python.ops import control_flow_ops
|
||||
try:
|
||||
from tensorflow.python.ops import ctc_ops as ctc
|
||||
except ImportError:
|
||||
import tensorflow.contrib.ctc as ctc
|
||||
from keras import backend as K
|
||||
import numpy as np
|
||||
import os
|
||||
import warnings
|
||||
from keras.backend.common import floatx, _EPSILON, image_dim_ordering, reset_uids
|
||||
py_all = all
|
||||
@@ -0,0 +1,19 @@
|
||||
import theano
|
||||
from theano import tensor as T
|
||||
from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
|
||||
from theano.tensor.signal import pool
|
||||
from theano.tensor.nnet import conv3d2d
|
||||
from theano.printing import Print
|
||||
try:
|
||||
import theano.sparse as th_sparse_module
|
||||
except ImportError:
|
||||
th_sparse_module = None
|
||||
try:
|
||||
from theano.tensor.nnet.nnet import softsign as T_softsign
|
||||
except ImportError:
|
||||
from theano.sandbox.softsign import softsign as T_softsign
|
||||
from keras import backend as K
|
||||
import inspect
|
||||
import numpy as np
|
||||
from keras.backend.common import _FLOATX, floatx, _EPSILON, image_dim_ordering
|
||||
py_all = all
|
||||
@@ -0,0 +1,22 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import csv
|
||||
|
||||
import numpy as np
|
||||
import time
|
||||
import json
|
||||
import warnings
|
||||
|
||||
from collections import deque
|
||||
from collections import OrderedDict
|
||||
from collections import Iterable
|
||||
from keras.utils.generic_utils import Progbar
|
||||
from keras import backend as K
|
||||
from pkg_resources import parse_version
|
||||
|
||||
try:
|
||||
import requests
|
||||
except ImportError:
|
||||
requests = None
|
||||
@@ -0,0 +1,6 @@
|
||||
from __future__ import absolute_import
|
||||
from . import backend as K
|
||||
from keras.utils.generic_utils import get_from_module
|
||||
|
||||
from keras.constraints import *
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
from __future__ import absolute_import
|
||||
import numpy as np
|
||||
from . import backend as K
|
||||
from keras.utils.generic_utils import get_from_module
|
||||
|
||||
from keras.initializations import *
|
||||
|
||||
|
||||
def get(identifier, **kwargs):
|
||||
return get_from_module(identifier, globals(),
|
||||
'initialization', kwargs=kwargs)
|
||||
@@ -0,0 +1,8 @@
|
||||
from . import backend as K
|
||||
from keras.utils.generic_utils import get_from_module
|
||||
|
||||
from keras.metrics import *
|
||||
|
||||
|
||||
def get(identifier):
|
||||
return get_from_module(identifier, globals(), 'metric')
|
||||
@@ -0,0 +1,10 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from . import backend as K
|
||||
from keras.utils.generic_utils import get_from_module
|
||||
|
||||
from keras.objectives import *
|
||||
|
||||
|
||||
def get(identifier):
|
||||
return get_from_module(identifier, globals(), 'objective')
|
||||
@@ -0,0 +1,19 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from six.moves import zip
|
||||
|
||||
from . import backend as K
|
||||
from keras.utils.generic_utils import get_from_module, get_custom_objects
|
||||
|
||||
if K.backend() == 'tensorflow':
|
||||
import tensorflow as tf
|
||||
|
||||
|
||||
def get(identifier, kwargs=None):
|
||||
if K.backend() == 'tensorflow':
|
||||
# Wrap TF optimizer instances
|
||||
if isinstance(identifier, tf.train.Optimizer):
|
||||
return TFOptimizer(identifier)
|
||||
# Instantiate a Keras optimizer
|
||||
return get_from_module(identifier, globals(), 'optimizer',
|
||||
instantiate=True, kwargs=kwargs)
|
||||
@@ -0,0 +1,10 @@
|
||||
from __future__ import absolute_import
|
||||
from . import backend as K
|
||||
from keras.utils.generic_utils import get_from_module
|
||||
|
||||
from keras.regularizers import *
|
||||
|
||||
|
||||
def get(identifier, kwargs=None):
|
||||
return get_from_module(identifier, globals(), 'regularizer',
|
||||
instantiate=True, kwargs=kwargs)
|
||||
@@ -0,0 +1 @@
|
||||
from keras.utils import *
|
||||
Reference in New Issue
Block a user