mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-03 08:57:54 +00:00
master @ 1ca8b078c12d915bca1f57e822859fa20bd439c8 Date: Tue Oct 15 10:50:12 2019 -0400
18 lines
354 B
Python
18 lines
354 B
Python
import tensorflow as tf
|
|
import os
|
|
import random
|
|
import numpy as np
|
|
|
|
def l1_loss(y, y_hat):
|
|
|
|
return tf.reduce_mean(tf.abs(y - y_hat))
|
|
|
|
def l2_loss(y, y_hat):
|
|
|
|
return tf.reduce_mean(tf.square(y - y_hat))
|
|
|
|
def cross_entropy_loss(logits, labels):
|
|
return tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(logits = logits, labels = labels))
|
|
|
|
|