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
NewFunctional
func(torch.Tensor) torch.Tensor
NewFunctional only accepts functions with func(torch.Tensor) torch.Tensor type.
We could write the following codes:
nn.NewFunctional(torch.Tanh)
However, LeakyRelu takes two input parameters.
LeakyRelu
func LeakyRelu(t Tensor, negativeSlope float64) Tensor { return t.LeakyRelu(negativeSlope) }
We could not write the following codes directly.
nn.NewFunctional(torch.LeakyRelu(0.2))
Maybe we should borrow more features from the functional programming language, like currying in Haskell.
torch.LeakyRelu(0.2) will return a function with func(torch.Tensor) torch.Tensor type. Then, it will work well with NewFunctional.
torch.LeakyRelu(0.2)
There is also a project maxsz/curry which provides a way to support currying in Go.
The text was updated successfully, but these errors were encountered:
This needs more discussion. At the moment we can use a lambda for this purpose:
nn.NewFunctional( func (in torch.Tensor) torch.Tensor { return torch.LeakyRelu(in, 0.2) })
With the help of Go+ lambda syntax sugar, this will be clear to write.
Sorry, something went wrong.
No branches or pull requests
NewFunctional
only accepts functions withfunc(torch.Tensor) torch.Tensor
type.We could write the following codes:
However,
LeakyRelu
takes two input parameters.We could not write the following codes directly.
Maybe we should borrow more features from the functional programming language, like currying in Haskell.
torch.LeakyRelu(0.2)
will return a function withfunc(torch.Tensor) torch.Tensor
type. Then, it will work well withNewFunctional
.There is also a project maxsz/curry which provides a way to support currying in Go.
The text was updated successfully, but these errors were encountered: