public override void ReadFrom(GraphFactory factory, BinaryReader reader) { var lap = factory?.LinearAlgebraProvider; InputSize = reader.ReadInt32(); OutputSize = reader.ReadInt32(); // read the bias parameters var bias = FloatVector.ReadFrom(reader); if (Bias == null) { Bias = lap.CreateVector(bias); } else { Bias.Data = bias; } // read the weight parameters var weight = FloatMatrix.ReadFrom(reader); if (Weight == null) { Weight = lap.CreateMatrix(weight); } else { Weight.Data = weight; } if (_updater == null) { _updater = factory?.CreateWeightUpdater(Weight); } }
public override void ReadFrom(GraphFactory factory, BinaryReader reader) { var lap = factory?.LinearAlgebraProvider; _padding = reader.ReadInt32(); _filterWidth = reader.ReadInt32(); _filterHeight = reader.ReadInt32(); _xStride = reader.ReadInt32(); _yStride = reader.ReadInt32(); _inputDepth = reader.ReadInt32(); _shouldBackpropagate = reader.ReadBoolean(); // read the bias parameters var bias = FloatVector.ReadFrom(reader); if (_bias == null) { _bias = lap.CreateVector(bias); } else { _bias.Data = bias; } // read the weight parameters var weight = FloatMatrix.ReadFrom(reader); if (_filter == null) { _filter = lap.CreateMatrix(weight); } else { _filter.Data = weight; } // read the updater if (_updater == null) { _updater = factory?.CreateWeightUpdater(_filter); } }