一系列常用模型的Keras实现
Multilayer Perceptron (MLP) for multi-class softmax classification
from keras.models import Sequential| { | |
| "dns": ["132.72.140.46", "132.72.140.45", "8.8.8.8"] | |
| } |
| [Unit] | |
| Description="Fixes immediate wakeup after suspend, by disabling all trigers but power/sleep btn" | |
| # https://askubuntu.com/a/1139215/562313 | |
| [Service] | |
| ExecStart=/bin/bash -c "echo PEG0 > /proc/acpi/wakeup && echo PEGP > /proc/acpi/wakeup && echo XHC > /proc/acpi/wakeup && echo RP09 > /proc/acpi/wakeup && echo PXSX > /proc/acpi/wakeup" | |
| [Install] | |
| WantedBy=multi-user.target |
| javascript: href=document.location.href; window.open(href.substr(0,href.indexOf('?')) + '/#search/rfc822msgid:' + '<' + encodeURIComponent(document.getElementsByClassName('message_id')[0].innerHTML.slice(4, -4)) + '>', "_self"); |
| #KeyboardPlay | |
| "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause" | |
| XF86AudioPlay | |
| #KeyboardStop | |
| "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Stop" | |
| XF86AudioStop | |
| #KeyboardPrev | |
| "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous" |
| import datetime | |
| DB_NAME = 'testdb' | |
| if __name__ == '__main__': | |
| import pymongo | |
| with pymongo.MongoClient("mongodb://localhost:27017/") as myclient: | |
| # mydb = myclient["mydatabase"] | |
| assert 'local' in myclient.list_database_names() |
| Section "InputClass" | |
| Identifier "Mouse Remap" | |
| MatchProduct "Mad Catz R.A.T.7 Mouse" | |
| MatchIsPointer "true" | |
| MatchDevicePath "/dev/input/event*" | |
| Option "Buttons" "24" | |
| Option "ButtonMapping" "1 2 3 4 5 0 0 8 9 10 11 12 0 0 0 16 17 7 6 0 0 0 0 0" | |
| Option "AutoReleaseButtons" "20 21 22 23 24" | |
| Option "ZAxisMapping" "4 5 6 7" | |
| EndSection |
| #!/bin/bash | |
| set -e | |
| # Any subsequent(*) commands which fail will cause the shell script to exit immediately | |
| cmake -DCMAKE_INSTALL_PREFIX=/home/shay/opt/packages/nest-simulator-2.16.0 \ | |
| -DPYTHON_EXECUTABLE=/usr/bin/python3 \ | |
| -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.5m.so \ | |
| -DPYTHON_INCLUDE_DIR=/usr/include/python3.5 \ | |
| -DPYTHON_INCLUDE_DIR2=/usr/include/x86_64-linux-gnu/python3.5m \ | |
| /home/shay/Downloads/NEST/nest-simulator-2.16.0 |
| '''Trains a simple convnet on the MNIST dataset. | |
| Gets to 99.25% test accuracy after 12 epochs | |
| (there is still a lot of margin for parameter tuning). | |
| 16 seconds per epoch on a GRID K520 GPU. | |
| ''' | |
| #from __future__ import print_function | |
| from tensorflow import keras as K | |
| # from keras.datasets import mnist | |
| # from keras.models import Sequential |
| from __future__ import print_function | |
| import argparse | |
| import torch | |
| import torch.nn as nn | |
| import torch.nn.functional as F | |
| import torch.optim as optim | |
| from torchvision import datasets, transforms | |
| class Net(nn.Module): |