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

Class TimeStepSlicer

mla/neuralnet/layers/basic.py:134–147  ·  view source on GitHub ↗

Take a specific time step from 3D tensor.

Source from the content-addressed store, hash-verified

132
133
134class TimeStepSlicer(Layer):
135 """Take a specific time step from 3D tensor."""
136
137 def __init__(self, step=-1):
138 self.step = step
139
140 def forward_pass(self, x):
141 return x[:, self.step, :]
142
143 def backward_pass(self, delta):
144 return np.repeat(delta[:, np.newaxis, :], 2, 1)
145
146 def shape(self, x_shape):
147 return x_shape[0], x_shape[2]
148
149
150class TimeDistributedDense(Layer):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected