MCPcopy Create free account
hub / github.com/rushter/MLAlgorithms / forward_pass

Method forward_pass

mla/neuralnet/layers/normalization.py:82–95  ·  view source on GitHub ↗
(self, X)

Source from the content-addressed store, hash-verified

80 return out
81
82 def forward_pass(self, X):
83 if len(X.shape) == 2:
84 # input is a regular layer
85 return self._forward_pass(X)
86 elif len(X.shape) == 4:
87 # input is a convolution layer
88 N, C, H, W = X.shape
89 x_flat = X.transpose(0, 2, 3, 1).reshape(-1, C)
90 out_flat = self._forward_pass(x_flat)
91 return out_flat.reshape(N, H, W, C).transpose(0, 3, 1, 2)
92 else:
93 raise NotImplementedError(
94 "Unknown model with dimensions = {}".format(len(X.shape))
95 )
96
97 def _backward_pass(self, delta):
98 # unfold the variables stored in cache

Callers

nothing calls this directly

Calls 1

_forward_passMethod · 0.95

Tested by

no test coverage detected