theano

How to swich theano.tensor to numpy.array?

丶灬走出姿态 提交于 2020-08-04 04:32:53
问题 I have simple codes as shown below: class testxx(object): def __init__(self, input): self.input = input self.output = T.sum(input) a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]], dtype = np.float32) classfier = testxx(a) outxx = classfier.output outxx = np.asarray(outxx, dtype = np.float32) However, I get the following error information: ValueError: setting an array element with a sequence. Furthermore, when I use the function of theano.tensor, it seems that what it returns is called "tensor"

How to swich theano.tensor to numpy.array?

馋奶兔 提交于 2020-08-04 04:32:48
问题 I have simple codes as shown below: class testxx(object): def __init__(self, input): self.input = input self.output = T.sum(input) a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]], dtype = np.float32) classfier = testxx(a) outxx = classfier.output outxx = np.asarray(outxx, dtype = np.float32) However, I get the following error information: ValueError: setting an array element with a sequence. Furthermore, when I use the function of theano.tensor, it seems that what it returns is called "tensor"

Implementing the Rprop algorithm in Keras

淺唱寂寞╮ 提交于 2020-08-02 09:49:10
问题 I am trying to implement the resilient backpropagation optimizer for Keras (link), but the challenging part was being able to perform an update on each individual parameter based on whether its corresponding gradient is positive, negative or zero. I wrote the code below as a start towards implementing the Rprop optimizer. However, I can't seem to find a way to access the parameters individually. Looping over params (as in the code below) returns p, g, g_old, s, wChangeOld at each iteration

Implementing the Rprop algorithm in Keras

回眸只為那壹抹淺笑 提交于 2020-08-02 09:48:09
问题 I am trying to implement the resilient backpropagation optimizer for Keras (link), but the challenging part was being able to perform an update on each individual parameter based on whether its corresponding gradient is positive, negative or zero. I wrote the code below as a start towards implementing the Rprop optimizer. However, I can't seem to find a way to access the parameters individually. Looping over params (as in the code below) returns p, g, g_old, s, wChangeOld at each iteration

Package installed by Conda, Python cannot find it

╄→гoц情女王★ 提交于 2020-08-01 03:38:32
问题 I try to install Theano by Anaconda. It works, but when I enter the python -i, import theano shows No module named 'theano' . Do I need to switch another interpreter of Python, how? Also, for the packages installed by conda, if I don't double install them, can I find in Python? How is Python related to Python by Anaconda? Thanks!!! 回答1: I had have a similar issue, trying to install folium . If you are using the Anaconda : When you install using conda install -c conda-forge folium , the

Keras mean squared error loss layer

帅比萌擦擦* 提交于 2020-07-08 11:31:35
问题 I am currently implementing a custom loss layer and in the process, I stumbled upon the implementation of mean squared error in the objectives.py file [1]. I know I'm missing something in my understanding of this loss calculation because I always thought that the average was done separately across the samples for each output in each mini-batch (axis 0 of the tensor) but it appears that the average is actually being done across the last axis, which in a single vector, would mean it's being

What is the number of filter in CNN?

[亡魂溺海] 提交于 2020-06-09 07:24:24
问题 I am currently seeing the API of theano, theano.tensor.nnet.conv2d(input, filters, input_shape=None, filter_shape=None, border_mode='valid', subsample=(1, 1), filter_flip=True, image_shape=None, **kwargs) where the filter_shape is a tuple of (num_filter, num_channel, height, width) , I am confusing about this because isn't that the number of filter decided by the stride while sliding the filter window on the image? How can I specify on filter number just like this? It would be reasonable to

Is it possible to activate virtualenv in Google-colab? (/bin/sh: 1: source: not found)

荒凉一梦 提交于 2020-05-25 14:12:54
问题 I am trying to install theano in Google Colab for testing. I have installed virtualenv and created an environment: !pip3 install virtualenv !virtualenv theanoEnv But am not able to activate the virtual environment even explicitly mentioned the location of 'activate' command. !source /content/theanoEnv/bin/activate theanoEnv Error Message is: /bin/sh: 1: source: not found Is it even possible to do?: source /[SomeVirtualEnv]/bin/activate SomeVirtualEnv 回答1: Short answer, I don't believe it is

Is it possible to activate virtualenv in Google-colab? (/bin/sh: 1: source: not found)

房东的猫 提交于 2020-05-25 14:10:20
问题 I am trying to install theano in Google Colab for testing. I have installed virtualenv and created an environment: !pip3 install virtualenv !virtualenv theanoEnv But am not able to activate the virtual environment even explicitly mentioned the location of 'activate' command. !source /content/theanoEnv/bin/activate theanoEnv Error Message is: /bin/sh: 1: source: not found Is it even possible to do?: source /[SomeVirtualEnv]/bin/activate SomeVirtualEnv 回答1: Short answer, I don't believe it is

Error: non-constant-expression cannot be narrowed from type 'npy_intp' to 'int'

浪子不回头ぞ 提交于 2020-05-10 21:14:13
问题 I am trying to run the following model, but it fails during compilation: import numpy as np import pymc3 as pm def sample_data(G=1, K=2): # mean proportion ([0,1]) for each g p_g = np.random.beta(2, 2, size=G) # concentration around each p_g c_g = np.random.lognormal(mean=0.5, sigma=1, size=G) # reparameterization for standard Beta(a,b) a_g = c_g * p_g / np.sqrt(p_g**2 + (1.-p_g)**2) b_g = c_g*(1.-p_g) / np.sqrt(p_g**2 + (1.-p_g)**2) # for each p_g, sample K proportions p_gk = np.random.beta