This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| Created on Nov 17, 2014 | |
| @author: Minh Ngoc Le | |
| ''' | |
| from pylearn2.models.mlp import Layer | |
| from pylearn2.space import IndexSpace, VectorSpace | |
| from pylearn2.utils import sharedX, wraps |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from theano import tensor as T | |
| import theano | |
| import numpy as np | |
| floatX = 'float32' | |
| num_blocks = 2 | |
| block_dims = 3 | |
| hidden_dims = 5 | |
| output_dims = 7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Running Torch... | |
| Last cost: 0.01029977761209 | |
| Time: 0 | |
| Using gpu device 0: GeForce GTX 980 | |
| Compiling function... | |
| Running Theano... | |
| Last cost: 3.135782 | |
| Time: 6.343242 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| th> i = torch.LongTensor(10) | |
| [0.0001s] | |
| th> i:random(10) | |
| 8 | |
| 2 | |
| 2 | |
| 2 | |
| 7 | |
| 2 | |
| 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| th> mask=torch.ByteTensor(10, 3):random(2):add(-1) | |
| [0.0001s] | |
| th> mask | |
| 1 0 1 | |
| 0 1 1 | |
| 1 1 1 | |
| 1 1 0 | |
| 0 1 1 | |
| 1 1 0 | |
| 1 0 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| th> x=torch.Tensor(2,3) | |
| [0.0000s] | |
| th> x:uniform() | |
| 0.2714 0.8744 0.5518 | |
| 0.3207 0.5189 0.8901 | |
| [torch.DoubleTensor of size 2x3] | |
| [0.0001s] | |
| th> x[1][2] = -math.huge | |
| [0.0000s] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local MaskedLogSoftMax, Parent = torch.class('nn.MaskedLogSoftMax', 'nn.Module') | |
| function MaskedLogSoftMax:__init(masks, filler) | |
| Parent.__init(self) | |
| self.masks = masks | |
| self.minvals = torch.Tensor() | |
| self.mininds = torch.LongTensor() | |
| self.temp1 = torch.Tensor() | |
| self.temp2 = torch.Tensor() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.*; | |
| import java.lang.*; | |
| import java.io.*; | |
| /* Name of the class has to be "Main" only if the class is public. */ | |
| class Ideone | |
| { | |
| public static void main (String[] args) throws java.lang.Exception | |
| { | |
| double a = Math.random(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import re | |
| count = 0 | |
| for root, dir_names, file_names in os.walk('ECB+'): | |
| for fname in file_names: | |
| if 'plus' in fname: | |
| path = os.path.join(root, fname) | |
| with open(path) as f: | |
| content = f.read() | |
| print list(m.group() for m in re.finditer('<token', content)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import re | |
| count = 0 | |
| for root, dir_names, file_names in os.walk('ECB+'): | |
| for fname in file_names: | |
| if 'plus' not in fname: | |
| path = os.path.join(root, fname) | |
| with open(path) as f: | |
| content = f.read() | |
| print list(m.group() for m in re.finditer('<token', content)) |
OlderNewer