text
stringlengths
0
93.6k
keys[0],
chunk=FLAGS.chunk)
vis_suite = vis.visualize_suite(pred_distance, pred_acc)
# Log eval summaries on host 0.
if jax.host_id() == 0:
psnr = math.mse_to_psnr(((pred_color - test_case['pixels'])**2).mean())
ssim = ssim_fn(pred_color, test_case['pixels'])
eval_time = time.time() - t_eval_start
num_rays = jnp.prod(jnp.array(test_case['rays'].directions.shape[:-1]))
rays_per_sec = num_rays / eval_time
summary_writer.scalar('test_rays_per_sec', rays_per_sec, step)
print(f'Eval {step}: {eval_time:0.3f}s., {rays_per_sec:0.0f} rays/sec')
summary_writer.scalar('test_psnr', psnr, step)
summary_writer.scalar('test_ssim', ssim, step)
summary_writer.image('test_pred_color', pred_color, step)
for k, v in vis_suite.items():
summary_writer.image('test_pred_' + k, v, step)
summary_writer.image('test_pred_acc', pred_acc, step)
summary_writer.image('test_target', test_case['pixels'], step)
if config.max_steps % config.save_every != 0:
state = jax.device_get(jax.tree_map(lambda x: x[0], state))
checkpoints.save_checkpoint(
FLAGS.train_dir, state, int(config.max_steps), keep=100)
if __name__ == '__main__':
app.run(main)
# <FILESEP>
#!/usr/bin/python
import os
import plistlib
import csv
import argparse
import sys
##############################
#### Start Define CLI Arguments ####
#
def getOptionsString(optionList):
# optionList should be a list item
optionsString = ''
for option in optionList:
if option == optionList[-1]:
optionsString += "\"%s\":\"%s\"" % (str(option.split('=')[0]), str(option.split('=')[1]))
else:
optionsString += "\"%s\":\"%s\"" % (str(option.split('=')[0]), str(option.split('=')[1])) + ', '
return optionsString
parser = argparse.ArgumentParser(description='Generate manifests from serial numbers.')
parser.add_argument('--dest', help='Destination for generated manifests. Default: /Library/WebServer/Documents/munki_repo/manifests/')
parser.add_argument('--catalogs', help='Catalogs you want for this set of manifests. Example: "Production, testing"')
parser.add_argument('--manifests', help='Included manifests you want for this set of manifests. Example: "[site_default, printers"')
parser.add_argument('--serials', help='Key value pairs of serial to display name. Example: "SERIALNUMBER1:DISPLAYNAME1, SERIALNUMBER2:DISPLAYNAME2"')
parser.add_argument('--csv', help='Path to CSV file containing printer info. If CSV is provided, all other options are ignored.')
args = parser.parse_args()
#### End Define CLI Arguments #####
###################################
######################################
#### Start user-defined variables ####
# Location of manifests folder on your server
# Not overridden by supplying a csv
manifests_directory = args.dest or '/Library/WebServer/Documents/munki_repo/manifests/'
# Values can be set inline or supplied at runtime as arguments.
# Arguments will override inline values
# Supplying a csv will take precedence over previous two methods
# Serial numbers and display names for manifests to be created
# Should be supplied in the form {"SERIALNUMBER1":"DISPLAYNAME1", "SERIALNUMBER2":DISPLAYNAME2"}
manifests_to_create = {}
# Specify whatever catalogs and included manifests you want for this set of manifests
manifest_catalogs = []
manifests_to_include = []
#### End user-defined variables #####
#####################################
def write_manifest(serial, display_name, catalogs, manifests):
# Initialize dictionary of XML content
manifest_content = { 'catalogs': [], 'managed_installs': [], 'managed_uninstalls': [], 'included_manifests': [] }
# Loop through the catalogs to include
for catalog in catalogs:
manifest_content['catalogs'].append(catalog)
# Add display name
manifest_content['display_name'] = display_name
# Loop through the manifests to include
for manifest in manifests:
manifest_content['included_manifests'].append(manifest)