for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import theano.tensor as T
from theano import tensor as theano_tensor
from decorations import neural_computation
from deepy.layers.neural_var import NeuralVariable
class NeuralTensorNet(object):
def __getattr__(self, func_name):
@neural_computation
def wrapper(*args, **kwargs):
return getattr(theano_tensor.nnet, func_name)(*args, **kwargs)
return wrapper
deepy_nnet = NeuralTensorNet()
class NeuralTensor(object):
"""
A class for exporting Theano tensor operations to neural variables.
def constant(self, value, dtype="float32", dim=None):
return NeuralVariable(T.constant(value, dtype=dtype), dim=dim)
global deepy_nnet
return getattr(theano_tensor, func_name)(*args, **kwargs)
if func_name == 'nnet':
return deepy_nnet
else:
deepy_tensor = NeuralTensor()
tensor = NT = deepy_tensor