Completed
Push — master ( 0a4690...96c2cd )
by Raphael
01:14
created

deepy.utils.NeuralTensor   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %
Metric Value
dl 0
loc 10
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A wrapper() 0 3 1
A __getattr__() 0 5 2
1
#!/usr/bin/env python
2
# -*- coding: utf-8 -*-
3
4
from theano import tensor
5
from decorations import neural_computation
6
7
class NeuralTensor():
8
    """
9
    A class for exporting Theano tensor operations to neural variables.
10
    """
11
12
    def __getattr__(self, func_name):
13
        @neural_computation
14
        def wrapper(*args, **kwargs):
15
            return getattr(tensor, func_name)(*args, **kwargs)
16
        return wrapper
17
18
19
neural_tensor = NeuralTensor()
20
NT = neural_tensor