-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAttGAN.fsx
47 lines (40 loc) · 1.65 KB
/
AttGAN.fsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/// NOTE This is a work in progress
// This is just for the decoder which as been repurposed into an embedder
// This depends on VariableScopes and Layers which are not yet available
#r "netstandard"
#r "lib/TensorFlowSharp.dll"
#load "shared/NNImpl.fsx"
#load "shared/NNOps.fsx"
#load "shared/NPYReaderWriter.fsx"
#load "shared/ImageWriter.fsx"
// This is from https://github.com/LynnHo/AttGAN-Tensorflow/blob/master/models.py
// Which is a tensorflow slim implementation
open NPYReaderWriter
open System
open System.IO
open TensorFlow
type Slim private () =
let x = 10
with
static member batch_norm(x:TFOutput,?scale:bool, ?updates_collections:'a[],?is_training:bool) = failwith "todo"
type TFGraph with
/// NOTE: This needs be fleshed out as per
/// https://github.com/tensorflow/tensorflow/blob/a6d8ffae097d0132989ae4688d224121ec6d8f35/tensorflow/python/ops/nn_ops.py#L1583
member this.LeakyRelu(features:TFOutput, ?alpha:float32, ?operName:string) =
use scope = this.WithScope("LeakyRelu")
let alphaV = defaultArg alpha 0.2f
this.Maximum(this.Mul(this.Const(new TFTensor(alphaV)),features),
features//,
//?operName=operName for some reason this isn't working
)
let MAX_DIM = 64 * 16
(*
let encoder(graph:TFGraph, input:TFOutput,n_layers:int, is_training:bool) =
let bn x = Slim.batch_norm(x,scale=false, updates_collections=[||], is_training=false)
let leakyRelu x = graph.LeakyRelu(x)
let conv2d(dim:int,y:int,stride:int) (x:TFOutput) = failwith "todo"
let conv_bn_lrelu x = graph.Conv2D(x) |> bn |> leakyRelu
()
let decoder() =
()
*)