Activation   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 13
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __init__() 0 4 1
A compute_tensor() 0 3 1
1
#!/usr/bin/env python
2
# -*- coding: utf-8 -*-
3
4
from layer import NeuralLayer
5
6
class Activation(NeuralLayer):
7
    """
8
    Activation layer.
9
    """
10
11
    def __init__(self, activation_type):
12
        from deepy.tensor.activations import get_activation
13
        super(Activation, self).__init__(activation_type)
14
        self._activation = get_activation(activation_type)
15
16
    def compute_tensor(self, x):
17
        self.activation = self._activation(x)
18
        return self.activation