Skip to content

Commit

Permalink
[system-a] move denseBlock to neurons/relu
Browse files Browse the repository at this point in the history
  • Loading branch information
xieyuheng committed Jun 6, 2024
1 parent 3b97e5e commit 549d7aa
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 16 deletions.
2 changes: 0 additions & 2 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# system-a

[system-a] move `denseBlock` to `neurons/relu` -- maybe rename to `reluBlock`

[neurons] `leakyRelu`
[neurons] `recuBlock`

Expand Down
1 change: 0 additions & 1 deletion src/system-a/block/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from "./Block.js"
export * from "./blockStack.js"
export * from "./denseBlock.js"
export * from "./emptyBlock.js"
12 changes: 6 additions & 6 deletions src/system-a/models/iris/irisModel.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {
blockStack,
denseBlock,
denseInitParameters,
} from "../../block/index.js"
import { blockStack } from "../../block/index.js"
import { gradientDescentAdam } from "../../gradient-descent/gradientDescentAdam.js"
import { gradientDescentNaked } from "../../gradient-descent/gradientDescentNaked.js"
import { gradientDescentRms } from "../../gradient-descent/gradientDescentRms.js"
import { l2Loss } from "../../loss/index.js"
import {
denseBlock,
denseBlockInitParameters,
} from "../../neurons/relu/index.js"
import type { Tensor } from "../../tensor/Tensor.js"
import { samplingObjective } from "../../tensor/samplingObjective.js"
import { model } from "../model.js"
Expand All @@ -31,7 +31,7 @@ export function irisTrainParameters(): Array<Tensor> {
},
)

const initParameters = denseInitParameters(irisNetwork.shapes)
const initParameters = denseBlockInitParameters(irisNetwork.shapes)

gradientDescentNaked
// const gradientDescentFn = gradientDescentNaked({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { relu } from "../neurons/relu/index.js"
import type { Tensor } from "../tensor/Tensor.js"
import { randomTensor } from "../tensor/randomTensor.js"
import type { Shape } from "../tensor/shape.js"
import { zeroTensor } from "../tensor/zeroTensor.js"
import { Block } from "./Block.js"
import { Block } from "../../block/index.js"
import { relu } from "../../neurons/relu/index.js"
import type { Tensor } from "../../tensor/Tensor.js"
import { randomTensor } from "../../tensor/randomTensor.js"
import type { Shape } from "../../tensor/shape.js"
import { zeroTensor } from "../../tensor/zeroTensor.js"

export function denseBlock(inputSize: number, layerWidth: number): Block {
return Block(relu, [[layerWidth, inputSize], [layerWidth]])
}

export function denseInitParameters(shapes: Array<Shape>): Array<Tensor> {
export function denseBlockInitParameters(shapes: Array<Shape>): Array<Tensor> {
return shapes.map(denseInitParameter)
}

Expand Down
1 change: 1 addition & 0 deletions src/system-a/neurons/relu/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from "./denseBlock.js"
export * from "./relu.js"

0 comments on commit 549d7aa

Please sign in to comment.