TorchSharp
TorchSharp copied to clipboard
Having trouble accessing training property of module
I tried to implement my own module and when attempting to read training property I get access violation error
from torchsharp
public virtual bool training
{
get
{
bool result = NativeMethods.THSNN_Module_is_training(handle);
CheckForErrors();
return result;
}
}
From my module:
public override Tensor forward(Tensor input)
{
Tensor weight = training ? _weightMu + _weightSigma * _weightEpsilon : _weightMu;
Tensor bias = _biasMu is not null ? (training ? _biasMu + _biasSigma * _biasEpsilon : _biasMu) : null;
return torch.nn.functional.linear(input, weight, bias);
}
I wanted to inherit linear but someone made it sealed for some reason but thats another issue.
failed to reproduce?