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
| class NeuralNetwork(nn.Module): | |
| def __init__(self, numChannels, classes): | |
| # call the parent constructor | |
| super(NeuralNetwork, self).__init__() | |
| # initialize first set of CONV => RELU => POOL layers | |
| self.conv1 = nn.Conv2d( | |
| in_channels=numChannels, out_channels=20, kernel_size=(5, 5) | |
| ) | |
| self.relu1 = nn.ReLU() | |
| self.maxpool1 = nn.MaxPool2d(kernel_size=(2, 2), stride=(2, 2)) |
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
| # Define model | |
| class NeuralNetwork(nn.Module): | |
| def __init__(self, input_size, output_size, hidden_dim, n_layers): | |
| super(NeuralNetwork, self).__init__() | |
| self.hidden_dim = hidden_dim | |
| self.n_layers = n_layers | |
| self.rnn = nn.RNN(input_size, hidden_dim, n_layers, batch_first=True) | |
| self.fc = nn.Linear(hidden_dim, output_size) |
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 numpy as np | |
| import pylab | |
| def is_prime(n): | |
| status = True | |
| if n < 2: | |
| status = False | |
| else: | |
| for i in range(2,n): |
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
| function mapStateToProps(state) { | |
| return { | |
| value: state.blackbox.value | |
| } | |
| } | |
| function mapDispatchToPops(dispatch) { | |
| return { | |
| setLHS: () => null, // TBD | |
| setRHS: () => null, // TBD |
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
| const BB_UPDATE_STATE = '@@blackbox.updateState'; | |
| const bbUpdateState = () => ({ | |
| type: BB_UPDATE_STATE | |
| }); | |
| const serializeState = () => ({ | |
| value: blackbox.getResult() | |
| }); |
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
| // BlackBox API | |
| // Constructor | |
| blackbox = new BlackBox(element: Element) | |
| // Methods | |
| blackbox.setLeft(value: Number) | |
| blackbox.setRight(value: Number) | |
| blackbox.getResult(): Number |
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
| [alias] | |
| ci = commit | |
| co = checkout | |
| st = status | |
| ss = status -sb | |
| ssb = submodule foreach 'git status -sb' | |
| br = branch | |
| bb = for-each-ref --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))' | |
| bn = !git for-each-ref --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))' | tail -n 10 | |
| clean-branches = !git branch -d $(git branch --merged develop | grep -v 'develop') |
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
| In [14]: class Foo(Model): | |
| name = StringType() | |
| def __getattr__(self, attr): | |
| print '__getattr__', attr | |
| return self.__dict__['_initial'].get(attr, None) | |
| def validate(self, partial=False, strict=False, **kwargs): | |
| try: | |
| super().validate(partial=partial, strict=strict, **kwargs) | |
| except ModelValidationError as exc: | |
| print(exc.messages) |
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 schematics.models import Model | |
| from schematics.types import StringType, URLType | |
| from schematics.transforms import import_loop | |
| import warnings | |
| class Foo(Model): | |
| name = StringType() |
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 subprocess as sp | |
| from binstar_build_client.worker.utils.timeout import Timeout | |
| import time | |
| import io | |
| import os | |
| class FakeBuildLog(object): | |
| """ | |
| This class should actually post to anaconda-server |
NewerOlder