Skip to content

Importing model refusing to output any information that is new? #561

Open
@albassort

Description

network TwoLayersNet:
  layers:
    fc1: Linear(300, 42)
    fc2: Linear(42, 300)
  forward x:
    x.fc1.relu.fc2

proc load*(ctx: Context[Tensor[float32]], inny : int): TwoLayersNet[float32] =
  result.fc1.weight = ctx.variable(read_npy[float32](&"model/hiddenweight{inny}.npy"), requires_grad = true)
  result.fc1.bias   = ctx.variable(read_npy[float32](&"model/hiddenbias{inny}.npy"), requires_grad = true)
  result.fc2.weight = ctx.variable(read_npy[float32](&"model/outputweight{inny}.npy"), requires_grad = true)
  result.fc2.bias   = ctx.variable(read_npy[float32](&"model/outputbias{inny}.npy"), requires_grad = true)

proc forward(network: TwoLayersNet, x: Variable): Variable =
  result =  x.linear(
    network.fc1.weight, network.fc1.bias).relu.linear(
      network.fc2.weight, network.fc2.bias)

This is essentially the same code as in the example, saved with the same function shown to me. But yet the output looks a bit like this.

image

I don't really know... what to do or where to go from here.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions