text
stringlengths 0
93.6k
|
---|
outputs = network.predict(x)
|
if args.image:
|
scipy.misc.imsave(args.outdir+"/input_"+args.image,inputs)
|
scipy.misc.imsave(args.outdir+"/output_"+args.image,outputs)
|
# <FILESEP>
|
#!/usr/bin/env python3
|
#
|
# Copyright (C) 2016 Vangelis Tasoulas <[email protected]>
|
#
|
# This program is free software: you can redistribute it and/or modify
|
# it under the terms of the GNU General Public License as published by
|
# the Free Software Foundation, either version 3 of the License, or
|
# (at your option) any later version.
|
#
|
# This program is distributed in the hope that it will be useful,
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# GNU General Public License for more details.
|
#
|
# You should have received a copy of the GNU General Public License
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
import os
|
import sys
|
import re
|
import argparse
|
import logging
|
import time
|
import xml.etree.ElementTree as et
|
import xml.dom.minidom as md
|
from collections import OrderedDict
|
import pygraphviz as pgv
|
__all__ = [
|
'quick_regexp', 'print_',
|
'hex_to_rgb', 'LOG'
|
]
|
PROGRAM_NAME = 'InfiniBand-Graphviz-ualization'
|
VERSION = '0.3.0'
|
AUTHOR = 'Vangelis Tasoulas'
|
LOG = logging.getLogger('default.' + __name__)
|
# ###############################################
|
# ############## HELPER FUNCTIONS ###############
|
# ###############################################
|
# ----------------------------------------------------------------------
|
def error_and_exit(message):
|
"""
|
Prints the "message" and exits with status 1
|
"""
|
print("\nFATAL ERROR:\n" + message + "\n")
|
exit(1)
|
# ----------------------------------------------------------------------
|
def print_(
|
value_to_be_printed, print_indent=0,
|
spaces_per_indent=4, endl="\n"):
|
"""
|
This function, among anything else, it will print dictionaries (even nested
|
ones) in a good looking way
|
# value_to_be_printed: The only needed argument and it is the
|
text/number/dictionary to be printed
|
# print_indent: indentation for the printed text (it is used for
|
nice looking dictionary prints) (default is 0)
|
# spaces_per_indent: Defines the number of spaces per indent (default is 4)
|
# endl: Defines the end of line character (default is \n)
|
More info here:
|
http://stackoverflow.com/questions/19473085/create-a-nested-dictionary-for-a-word-python?answertab=active#tab-top
|
"""
|
if isinstance(value_to_be_printed, dict):
|
for key, value in value_to_be_printed.items():
|
if isinstance(value, dict):
|
print_('{0}{1!r}:'.format(
|
print_indent * spaces_per_indent * ' ', key))
|
print_(value, print_indent + 1)
|
else:
|
print_('{0}{1!r}: {2}'.format(
|
print_indent * spaces_per_indent * ' ', key, value))
|
else:
|
string = ('{0}{1}{2}'.format(
|
print_indent * spaces_per_indent * ' ', value_to_be_printed, endl))
|
sys.stdout.write(string)
|
# ----------------------------------------------------------------------
|
def hex_to_rgb(value):
|
value = value.lstrip('#')
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.