-
Notifications
You must be signed in to change notification settings - Fork 3
/
exceptions.py
66 lines (42 loc) · 2.61 KB
/
exceptions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
__author__ = 'tarun'
def makeErrorMessage(message):
"""
:rtype : string
"""
return 'CoolName Exception: %s' % message
class InputLayerNotDefined(Exception):
def __init__(self, networkName):
super(InputLayerNotDefined,self).__init__(makeErrorMessage("Input Layer not defined for network %s" % networkName))
class OutputLayerNotDefined(Exception):
def __init__(self, networkName):
super(OutputLayerNotDefined,self).__init__(makeErrorMessage("Output Layer not defined for network %s" % networkName))
class ActivationFunctionNotImplemented(Exception):
def __init__(self, passFunction):
super(ActivationFunctionNotImplemented,self).__init__(makeErrorMessage("Activation Function is not implemented %s" % passFunction))
class LossFunctionNotImplemented(Exception):
def __init__(self, lossFunction):
super(LossFunctionNotImplemented,self).__init__(makeErrorMessage("Loss Function is not implemented %s" % lossFunction))
class MiniBatchSizeNotInteger(Exception):
def __init__(self, networkName):
super(MiniBatchSizeNotInteger,self).__init__(makeErrorMessage("For network %s, the mini batch size is not integer " % networkName))
class SizeMismatch(Exception):
def __init__(self, toLayerShape, fromLayerShape, message):
super(SizeMismatch,self).__init__(makeErrorMessage("%s . toLayer shape = %d, fromLayer shape = %d" % (message, toLayerShape, fromLayerShape)))
class AggregateMethodNotDefined(Exception):
def __init__(self, aggregate_method):
super(AggregateMethodNotDefined,self).__init__(makeErrorMessage("Aggregate Method is not implemented %s" % aggregate_method))
class DropoutPercentInvalid(Exception):
def __init__(self, dropout):
super(DropoutPercentInvalid,self).__init__(makeErrorMessage("Dropout level must be in interval [0, 1]. Dropout mentioned is %d" % dropout))
class ConnectionToItself(Exception):
def __init__(self):
super(ConnectionToItself,self).__init__(makeErrorMessage("Can not connect the layer to itself in Dense connections"))
class NetworkNotDAG(Exception):
def __init__(self):
super(NetworkNotDAG,self).__init__(makeErrorMessage("Network is not a DAG. It contains a cycle."))
class PoolingNotPossible(Exception):
def __init__(self):
super(PoolingNotPossible,self).__init__(makeErrorMessage("Downsampling not possible. Please check your poolsize"))
class ConvolutionNotPossible(Exception):
def __init__(self):
super(ConvolutionNotPossible,self).__init__(makeErrorMessage("Convolution between the two layers not possible. Please check the convolution configuration"))