Softmax3D.__init__()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
c 0
b 0
f 0
dl 0
loc 2
rs 10
1
#!/usr/bin/env python
2
# -*- coding: utf-8 -*-
3
4
from layer import NeuralLayer
5
import theano
6
import theano.tensor as T
7
8
class Softmax3D(NeuralLayer):
9
10
    def __init__(self):
11
        super(Softmax3D, self).__init__("softmax")
12
13
    def compute_tensor(self, x):
14
        shape = x.shape
15
        x = x.reshape((-1, shape[-1]))
16
        softmax_tensor = T.nnet.softmax(x)
17
18
        return softmax_tensor.reshape(shape)