Skip to content

Instantly share code, notes, and snippets.

@mratsim
Created April 28, 2018 09:39
Show Gist options
  • Select an option

  • Save mratsim/98c59c0a173c06d1bf406b88f4683277 to your computer and use it in GitHub Desktop.

Select an option

Save mratsim/98c59c0a173c06d1bf406b88f4683277 to your computer and use it in GitHub Desktop.
type
TrainableLayer = object {.inheritable.}
## Layer with trainable parameters
weight: int
bias: int
Conv2DLayer{.final.} = object of TrainableLayer
LinearLayer{.final.} = object of TrainableLayer
#################################################
type
Trainable = concept layer
layer.weight is int
layer.bias is int
Conv2D_v2 = object
weight: int
bias: int
Linear_v2 = object
weight: int
bias: int
let a = Conv2DLayer(weight: 1, bias: 10)
let b = Conv2D_v2(weight: 2, bias: 3)
echo a is Trainable
echo b is Trainable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment