We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Many of the gcn and also the train functions might be generalized to allow for a more modular and broader use.
gcn
train
E.g. the GCNModel.create function might be generalized to a compose function:
GCNModel.create
Instead of
let create nfeat nhid nclass dropout adj = let gc1 = gcnLayer nfeat nhid true adj let gc2 = gcnLayer nhid nclass true adj let drp = Dropout(dropout) |> M F [gc1;gc2;drp] (fun t -> use t = gc1.forward(t) use t = Functions.ReLU(t) use t = drp.forward(t) use t = gc2.forward(t) let t = Functions.LogSoftmax(t, dimension=1L) t)
there could be a general layer composition function
let composeWithDropOut (dropOut : #IModel) (activationFunc : TorchTensor -> TorchTensor) (outFunc : TorchTensor -> TorchTensor) (layers : FuncModel list) = let rec composeF (f : TorchTensor -> TorchTensor) (remainingLayers : #IModel list) = match remainingLayers with | [] -> failwith "no layers were given" | l :: [] -> f >> l.forward >> outFunc | l :: ls -> composeF (f >> l.forward >> dropOut.forward >> activationFunc) ls let forward = composeF id layers let models : IModel list = List.append (layers |> List.map (fun x -> x :> IModel)) [dropOut] F models forward
with your specific case resulting in
///Create two layer GCN model with dropout let create nfeat nhid nclass dropout adj = let gc1 = gcnLayer nfeat nhid true adj let gc2 = gcnLayer nhid nclass true adj let drp = Dropout(dropout) |> M composeWithDropOut drp (fun t -> Functions.ReLU(t)) (fun t -> Functions.LogSoftmax(t,dimension=1L)) [gc1;gc2]
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Many of the
gcn
and also thetrain
functions might be generalized to allow for a more modular and broader use.E.g. the
GCNModel.create
function might be generalized to a compose function:Instead of
there could be a general layer composition function
with your specific case resulting in
The text was updated successfully, but these errors were encountered: