def test_tf(self): with self.graph_on_cpu() as g: x = tf.constant(_input_tensor()) y = flatten(x) with self.test_session() as sess: result = sess.run(y) self.assertCorrent(result)
def kernel(self, inputs): x = inputs[self.KEYS.TENSOR.HITS] x = flatten(x) m = identity models = [] for i in range(3): models += [Dense(self.config(self.KEYS.CONFIG.NB_UNITS) [i], info='dense_{}'.format(i)), ReLU, DropOut()] # models.append(DropOut()) models.append( Dense(self.config(self.KEYS.CONFIG.MAX_NB_HITS), info='dense_end')) seq = self.graphs.get('seq', Stack(info='stack', models=models)) return seq(x)
def kernel(self, inputs): x = inputs[self.KEYS.TENSOR.HITS] x = flatten(x) m = identity models = [] for i in range(len(self.config(self.KEYS.CONFIG.NB_UNITS))): models += [Dense(self.config(self.KEYS.CONFIG.NB_UNITS) [i], info='dense_{}'.format(i)), ReLU, DropOut()] models.append( Dense(self.config(self.KEYS.CONFIG.MAX_NB_HITS), info='dense_end')) if self.graphs.get(self.KEYS.GRAPH.SEQUENTIAL) is None: self.graphs[self.KEYS.GRAPH.SEQUENTIAL] = Sequential( info='stack', models=models) return self.graphs[self.KEYS.GRAPH.SEQUENTIAL](x)
def test_cntk(): x = cntk.input([2, 2], np.float32) y = flatten(x) result = y.eval({x: _input_tensor()}) _assert_correct(result)
def test_np(self): x = flatten(_input_tensor()) self.assertCorrent(x)