Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/arraymancer/nn/layers/conv2D.nim
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ type

proc init*[T](
ctx: Context[Tensor[T]],
layerType: typedesc[Conv2D[T]],
layerType: typedesc[Conv2D],
inShape: seq[int],
outChannels: int,
kernelSize: Size2D,
Expand Down
2 changes: 1 addition & 1 deletion src/arraymancer/nn/layers/embedding.nim
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ type

proc init*[T](
ctx: Context[Tensor[T]],
layerType: typedesc[Embedding[T]],
layerType: typedesc[Embedding],
vocabSize, embedSize: int,
paddingIdx: VocabIdx = -1
): Embedding[T] =
Expand Down
2 changes: 1 addition & 1 deletion src/arraymancer/nn/layers/flatten.nim
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type

proc init*[T](
ctx: Context[Tensor[T]],
layerType: typedesc[Flatten[T]],
layerType: typedesc[Flatten],
inShape: seq[int]
): Flatten[T] =

Expand Down
2 changes: 1 addition & 1 deletion src/arraymancer/nn/layers/gcn.nim
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ type

proc init*[T](
ctx: Context[Tensor[T]],
layerType: typedesc[GCNLayer[T]],
layerType: typedesc[GCNLayer],
numInput, numOutput: int
): GCNLayer[T] =
## Initializes a graph convolutional layer with `num_input` input features and `num_output` output features.
Expand Down
2 changes: 1 addition & 1 deletion src/arraymancer/nn/layers/gru.nim
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ type

proc init*[T](
ctx: Context[Tensor[T]],
layerType: typedesc[GRULayer[T]],
layerType: typedesc[GRULayer],
numInputFeatures, hiddenSize, layers: int
): GRULayer[T] =

Expand Down
2 changes: 1 addition & 1 deletion src/arraymancer/nn/layers/linear.nim
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ type

proc init*[T](
ctx: Context[Tensor[T]],
layerType: typedesc[Linear[T]],
layerType: typedesc[Linear],
numInput, numOutput: int
): Linear[T] =
## Initializes a linear layer with `numInput` input features and `numOutput` output features.
Expand Down
2 changes: 1 addition & 1 deletion src/arraymancer/nn/layers/maxpool2D.nim
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ type

proc init*[T](
ctx: Context[Tensor[T]],
layerType: typedesc[MaxPool2D[T]],
layerType: typedesc[MaxPool2D],
inShape: seq[int],
kernelSize, padding, stride: Size2D
): MaxPool2D[T] =
Expand Down
9 changes: 3 additions & 6 deletions src/arraymancer/nn/nn_dsl.nim
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ proc createModelType(layerInfos: seq[LayerInfo], modelName: NimNode): NimNode =
proc createInitProc(layerInfos: seq[LayerInfo], sectionInfo: SectionInfo, modelName: NimNode): NimNode =

# creates init function of the model, e.g.:
# proc init[T](ctx: Context[AnyTensor[T]], modelType: typedesc[SomeConvNet[T]], h: auto; w: auto): SomeConvNet[T] =
# proc init[T](ctx: Context[AnyTensor[T]], modelType: typedesc[SomeConvNet], h: auto; w: auto): SomeConvNet[T] =
# template cv(): auto =
# result.cv
# template mp(): auto =
Expand Down Expand Up @@ -201,10 +201,7 @@ proc createInitProc(layerInfos: seq[LayerInfo], sectionInfo: SectionInfo, modelN
genSym(nskParam, "modelType"),
newNimNode(nnkBracketExpr).add(
ident"typedesc",
newNimNode(nnkBracketExpr).add(
modelName,
underlyingTypeSymbol
)
modelName
)
)
]
Expand Down Expand Up @@ -357,7 +354,7 @@ macro network*(modelName: untyped, config: untyped): untyped =
## .. code:: nim
## proc init*[T](
## ctx: Context[Tensor[T]], # could also be Context[AnyTensor[T]] for example
## layerType: typedesc[MyLayer[T]],
## layerType: typedesc[MyLayer],
## myInitParam: string
## # ... here you can add all the necessary init parameters, like shapes and number of output features
## ): MyLayer[T] =
Expand Down
Loading