Python theano.tensor.all() Examples
The following are 30
code examples of theano.tensor.all().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
theano.tensor
, or try the search function
.
Example #1
Source File: test_elemwise.py From attention-lvcsr with MIT License | 6 votes |
def test_c(self): if not theano.config.cxx: raise SkipTest("G++ not available, so we need to skip this test.") for dtype in ["floatX", "complex64", "complex128", "int8", "uint8"]: self.with_linker(gof.CLinker(), scalar.add, dtype=dtype) self.with_linker(gof.CLinker(), scalar.mul, dtype=dtype) for dtype in ["floatX", "int8", "uint8"]: self.with_linker(gof.CLinker(), scalar.minimum, dtype=dtype) self.with_linker(gof.CLinker(), scalar.maximum, dtype=dtype) self.with_linker(gof.CLinker(), scalar.and_, dtype=dtype, tensor_op=tensor.all) self.with_linker(gof.CLinker(), scalar.or_, dtype=dtype, tensor_op=tensor.any) for dtype in ["int8", "uint8"]: self.with_linker(gof.CLinker(), scalar.or_, dtype=dtype) self.with_linker(gof.CLinker(), scalar.and_, dtype=dtype) self.with_linker(gof.CLinker(), scalar.xor, dtype=dtype)
Example #2
Source File: thutil.py From Depth-Map-Prediction with GNU General Public License v3.0 | 6 votes |
def local_gpu_togpu(node): if node.op == gpu_from_host: host_input = node.inputs[0] if host_input.owner and \ hasattr(host_input.owner.op, 'make_gpu_node'): try: gpu_inputs = map(gpu_from_host, host_input.owner.inputs) except TypeError: return False return [host_input.owner.op.make_gpu_node(*gpu_inputs)] elif hasattr(node.op, 'make_gpu_node') and \ all([x.owner and x.owner.op == host_from_gpu for x in node.inputs]): gpu_inputs = [x.owner.inputs[0] for x in node.inputs] return [host_from_gpu(node.op.make_gpu_node(*gpu_inputs))] return False
Example #3
Source File: test_elemwise.py From D-VAE with MIT License | 6 votes |
def test_c(self): if not theano.config.cxx: raise SkipTest("G++ not available, so we need to skip this test.") for dtype in ["floatX", "complex64", "complex128", "int8", "uint8"]: self.with_linker(gof.CLinker(), scalar.add, dtype=dtype) self.with_linker(gof.CLinker(), scalar.mul, dtype=dtype) for dtype in ["floatX", "int8", "uint8"]: self.with_linker(gof.CLinker(), scalar.minimum, dtype=dtype) self.with_linker(gof.CLinker(), scalar.maximum, dtype=dtype) self.with_linker(gof.CLinker(), scalar.and_, dtype=dtype, tensor_op=tensor.all) self.with_linker(gof.CLinker(), scalar.or_, dtype=dtype, tensor_op=tensor.any) for dtype in ["int8", "uint8"]: self.with_linker(gof.CLinker(), scalar.or_, dtype=dtype) self.with_linker(gof.CLinker(), scalar.and_, dtype=dtype) self.with_linker(gof.CLinker(), scalar.xor, dtype=dtype)
Example #4
Source File: attention.py From attention-lvcsr with MIT License | 6 votes |
def compute_weights(self, energies, attended_mask): if self.energy_normalizer == 'softmax': logger.debug("Using softmax attention weights normalization") energies = energies - energies.max(axis=0) unnormalized_weights = tensor.exp(energies) elif self.energy_normalizer == 'logistic': logger.debug("Using smoothfocus (logistic sigm) " "attention weights normalization") unnormalized_weights = tensor.nnet.sigmoid(energies) elif self.energy_normalizer == 'relu': logger.debug("Using ReLU attention weights normalization") unnormalized_weights = tensor.maximum(energies/1000., 0.0) else: raise Exception("Unknown energey_normalizer: {}" .format(self.energy_computer)) if attended_mask: unnormalized_weights *= attended_mask # If mask consists of all zeros use 1 as the normalization coefficient normalization = (unnormalized_weights.sum(axis=0) + tensor.all(1 - attended_mask, axis=0)) return unnormalized_weights / normalization
Example #5
Source File: theano_backend.py From keras-lambda with MIT License | 5 votes |
def zeros(shape, dtype=None, name=None): """Instantiates an all-zeros variable. """ if dtype is None: dtype = floatx() return variable(np.zeros(shape), dtype, name)
Example #6
Source File: theano_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def all(x, axis=None, keepdims=False): """Bitwise reduction (logical AND). """ return T.all(x, axis=axis, keepdims=keepdims)
Example #7
Source File: theano_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def _preprocess_conv2d_kernel(kernel, data_format): # As of Keras 2.0.0, all kernels are normalized # on the format `(rows, cols, input_depth, depth)`, # independently of `data_format`. # Theano expects `(depth, input_depth, rows, cols)`. kernel = kernel.dimshuffle((3, 2, 0, 1)) return kernel
Example #8
Source File: theano_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def zeros(shape, dtype=None, name=None): """Instantiates an all-zeros variable. """ if dtype is None: dtype = floatx() return variable(np.zeros(shape), dtype, name)
Example #9
Source File: theano_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def ones(shape, dtype=None, name=None): """Instantiates an all-ones variable. """ if dtype is None: dtype = floatx() return variable(np.ones(shape), dtype, name)
Example #10
Source File: theano_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def all(x, axis=None, keepdims=False): """Bitwise reduction (logical AND). """ return T.all(x, axis=axis, keepdims=keepdims)
Example #11
Source File: theano_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def ones(shape, dtype=None, name=None): """Instantiates an all-ones variable. """ if dtype is None: dtype = floatx() return variable(np.ones(shape), dtype, name)
Example #12
Source File: theano_backend.py From deepQuest with BSD 3-Clause "New" or "Revised" License | 5 votes |
def _preprocess_conv2d_kernel(kernel, data_format): # As of Keras 2.0.0, all kernels are normalized # on the format `(rows, cols, input_depth, depth)`, # independently of `data_format`. # Theano expects `(depth, input_depth, rows, cols)`. kernel = kernel.dimshuffle((3, 2, 0, 1)) return kernel
Example #13
Source File: theano_backend.py From KerasNeuralFingerprint with MIT License | 5 votes |
def zeros(shape, dtype=_FLOATX, name=None): '''Instantiate an all-zeros variable. ''' return variable(np.zeros(shape), dtype, name)
Example #14
Source File: theano_backend.py From KerasNeuralFingerprint with MIT License | 5 votes |
def ones(shape, dtype=_FLOATX, name=None): '''Instantiate an all-ones variable. ''' return variable(np.ones(shape), dtype, name)
Example #15
Source File: theano_backend.py From KerasNeuralFingerprint with MIT License | 5 votes |
def all(x, axis=None, keepdims=False): '''Bitwise reduction (logical AND). ''' return T.all(x, axis=axis, keepdims=keepdims)
Example #16
Source File: theano_backend.py From keras-lambda with MIT License | 5 votes |
def all(x, axis=None, keepdims=False): """Bitwise reduction (logical AND). """ return T.all(x, axis=axis, keepdims=keepdims)
Example #17
Source File: theano_backend.py From keras-lambda with MIT License | 5 votes |
def _preprocess_conv3d_kernel(kernel, data_format): # As of Keras 2.0.0, all kernels are normalized # on the format `(space, input_depth, depth)`, # independently of `data_format`. # Theano expects `(depth, input_depth, space)`. kernel = kernel.dimshuffle((4, 3, 0, 1, 2)) return kernel
Example #18
Source File: theano_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def all(x, axis=None, keepdims=False): """Bitwise reduction (logical AND). """ return T.all(x, axis=axis, keepdims=keepdims)
Example #19
Source File: theano_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def zeros(shape, dtype=None, name=None): """Instantiates an all-zeros variable. """ if dtype is None: dtype = floatx() return variable(np.zeros(shape), dtype, name)
Example #20
Source File: theano_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def _preprocess_conv3d_kernel(kernel, data_format): # As of Keras 2.0.0, all kernels are normalized # on the format `(space, input_depth, depth)`, # independently of `data_format`. # Theano expects `(depth, input_depth, space)`. kernel = kernel.dimshuffle((4, 3, 0, 1, 2)) return kernel
Example #21
Source File: theano_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def all(x, axis=None, keepdims=False): """Bitwise reduction (logical AND). """ return T.all(x, axis=axis, keepdims=keepdims)
Example #22
Source File: theano_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def ones(shape, dtype=None, name=None): """Instantiates an all-ones variable. """ if dtype is None: dtype = floatx() return variable(np.ones(shape), dtype, name)
Example #23
Source File: theano_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def zeros(shape, dtype=None, name=None): """Instantiates an all-zeros variable. """ if dtype is None: dtype = floatx() return variable(np.zeros(shape), dtype, name)
Example #24
Source File: theano_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def _preprocess_conv3d_kernel(kernel, data_format): # As of Keras 2.0.0, all kernels are normalized # on the format `(space, input_depth, depth)`, # independently of `data_format`. # Theano expects `(depth, input_depth, space)`. kernel = kernel.dimshuffle((4, 3, 0, 1, 2)) return kernel
Example #25
Source File: theano_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def _preprocess_conv2d_kernel(kernel, data_format): # As of Keras 2.0.0, all kernels are normalized # on the format `(rows, cols, input_depth, depth)`, # independently of `data_format`. # Theano expects `(depth, input_depth, rows, cols)`. kernel = kernel.dimshuffle((3, 2, 0, 1)) return kernel
Example #26
Source File: theano_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def ones(shape, dtype=None, name=None): """Instantiates an all-ones variable. """ if dtype is None: dtype = floatx() return variable(np.ones(shape), dtype, name)
Example #27
Source File: theano_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def zeros(shape, dtype=None, name=None): """Instantiates an all-zeros variable. """ if dtype is None: dtype = floatx() return variable(np.zeros(shape), dtype, name)
Example #28
Source File: theano_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def _preprocess_conv3d_kernel(kernel, data_format): # As of Keras 2.0.0, all kernels are normalized # on the format `(space, input_depth, depth)`, # independently of `data_format`. # Theano expects `(depth, input_depth, space)`. kernel = kernel.dimshuffle((4, 3, 0, 1, 2)) return kernel
Example #29
Source File: theano_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def _preprocess_conv2d_kernel(kernel, data_format): # As of Keras 2.0.0, all kernels are normalized # on the format `(rows, cols, input_depth, depth)`, # independently of `data_format`. # Theano expects `(depth, input_depth, rows, cols)`. kernel = kernel.dimshuffle((3, 2, 0, 1)) return kernel
Example #30
Source File: theano_backend.py From DeepLearning_Wavelet-LSTM with MIT License | 5 votes |
def _preprocess_conv2d_kernel(kernel, data_format): # As of Keras 2.0.0, all kernels are normalized # on the format `(rows, cols, input_depth, depth)`, # independently of `data_format`. # Theano expects `(depth, input_depth, rows, cols)`. kernel = kernel.dimshuffle((3, 2, 0, 1)) return kernel