This file contains 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
#!/usr/freeware/bin/python | |
## #!/home/QtPalmtop/bin/python | |
#------------------------------------------------------------------------------------------- | |
#------------------------------------------------------------------------------------------- | |
# Ustructured NN | |
# Kolergy | |
# Written in Python. See http://www.python.org/ | |
#------------------------------------------------------------------------------------------- | |
#------------------------------------------------------------------------------------------- |
This file contains 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
with tf.device(gpu): | |
# Generator | |
x8 = tf.placeholder(tf.float32, shape=[None, FLAGS.ws, FLAGS.ws, 8]) | |
x3 = tf.placeholder(tf.float32, shape=[None, scale * FLAGS.ws, scale * FLAGS.ws, 3]) | |
label_distance = tf.placeholder(tf.float32, shape=[None, FLAGS.ws, FLAGS.ws, 1]) | |
for i in range(layers): | |
alpha[i] = tf.Variable(0.9, name='alpha_' + str(i)) | |
beta[i] = tf.maximum( 0.0 , tf.minimum ( 1.0 , alpha[i] ), name='beta_'+str(i)) | |
bi[i] = tf.Variable(tf.constant(0.0,shape=[FLAGS.filters]), name='bi_'+str(i)) | |
bo[i] = tf.Variable(tf.constant(0.0,shape=[FLAGS.filters]), name='bo_'+str(i)) |
This file contains 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
#!/usr/bin/env python | |
""" | |
A quick, partial implementation of ENet (https://arxiv.org/abs/1606.02147) using PyTorch. | |
The original Torch ENet implementation can process a 480x360 image in ~12 ms (on a P2 AWS | |
instance). TensorFlow takes ~35 ms. The PyTorch implementation takes ~25 ms, an improvement | |
over TensorFlow, but worse than the original Torch. | |
""" | |
from __future__ import absolute_import |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
#!/bin/bash | |
# Activate the build environment | |
eval "$(conda shell.bash hook)" | |
conda activate pytorch-dev | |
cd ~/git/pytorch | |
# Enable ccache | |
export CCACHE_COMPRESS=true |
This file contains 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
''' | |
To run the CPU benchmark: `CUDA_VISIBLE_DEVICES="" python benchmark.py --name cpu` | |
To run the GPU benchmark: `CUDA_VISIBLE_DEVICES=0 python benchmark.py --name cuda` | |
To run the distributed benchmark: `python -u -m torch.distributed.launch --nproc_per_node=2 --use_env benchmark.py --name dist` | |
''' | |
import argparse | |
import time | |
import math |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
# Portions Copyright 2016 The Kubernetes Authors All rights reserved. | |
# Portions Copyright 2018 AspenMesh | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software |
This file contains 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 torch | |
import warnings | |
import threading | |
import numpy as np | |
from ignite.engine.engine import Engine, Events | |
def ensure_tuple(vals): | |
""" | |
Returns a tuple containing just `vals` if it is not a list or tuple, or `vals` converted to a tuple otherwise. |
OlderNewer