Softmax3D   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 11
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A compute_tensor() 0 6 1
A __init__() 0 2 1
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)