This document provides help on getting your Laravel instance running with the latest versions of Laravel Mix and Font Awesome. Note: This guide is for Laravel versions 5 through 7. If you are using Laravel 8, please go here.
|
This document provides help on getting your Laravel instance running with the latest versions of Laravel Mix and Font Awesome. Note: This guide is for Laravel versions 5 through 7. If you are using Laravel 8, please go here.
|
class STLR(torch.optim.lr_scheduler._LRScheduler): | |
def __init__(self, optimizer, max_mul, ratio, steps_per_cycle, decay=1, last_epoch=-1): | |
self.max_mul = max_mul - 1 | |
self.turning_point = steps_per_cycle // (ratio + 1) | |
self.steps_per_cycle = steps_per_cycle | |
self.decay = decay | |
super().__init__(optimizer, last_epoch) | |
def get_lr(self): | |
residual = self.last_epoch % self.steps_per_cycle |
class ContrastiveLoss(torch.nn.Module): | |
""" | |
Contrastive loss function. | |
Based on: http://yann.lecun.com/exdb/publis/pdf/hadsell-chopra-lecun-06.pdf | |
""" | |
def __init__(self, margin=2.0): | |
super(ContrastiveLoss, self).__init__() | |
self.margin = margin |
#!/bin/bash | |
# Based on http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html | |
# Requires ffmpeg | |
filename="${1%.*}" | |
palette="/tmp/palette.png" | |
filters="scale=320:-1:flags=lanczos" | |
ffmpeg -v warning -i "$1" -vf "$filters,palettegen" -y $palette | |
ffmpeg -v warning -i "$1" -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y "$filename.gif" |
import shapefile | |
# read the shapefile | |
reader = shapefile.Reader("my.shp") | |
fields = reader.fields[1:] | |
field_names = [field[0] for field in fields] | |
buffer = [] | |
for sr in reader.shapeRecords(): | |
atr = dict(zip(field_names, sr.record)) | |
geom = sr.shape.__geo_interface__ | |
buffer.append(dict(type="Feature", \ |