func (l *lstmGate) Serialize() ([]byte, error) { slist := []serializer.Serializer{l.Dense, l.Activation} if l.Peephole != nil { data, err := json.Marshal(l.Peephole) if err != nil { return nil, err } slist = append(slist, serializer.Bytes(data)) } return serializer.SerializeSlice(slist) }
// Serialize serializes the block. func (n *NetworkBlock) Serialize() ([]byte, error) { initData, err := json.Marshal(n.batcherBlock.Start) if err != nil { return nil, err } serializers := []serializer.Serializer{ serializer.Int(n.batcherBlock.StateSize), n.network, serializer.Bytes(initData), } return serializer.SerializeSlice(serializers) }
// Serialize serializes the block. func (g *GRU) Serialize() ([]byte, error) { initData, err := json.Marshal(g.initState) if err != nil { return nil, err } slist := []serializer.Serializer{ serializer.Int(g.hiddenSize), g.inputValue, g.resetGate, g.updateGate, serializer.Bytes(initData), } return serializer.SerializeSlice(slist) }
// Serialize serializes the LSTM. func (l *LSTM) Serialize() ([]byte, error) { initData, err := json.Marshal(l.initState) if err != nil { return nil, err } slist := []serializer.Serializer{ serializer.Int(l.hiddenSize), l.inputValue, l.inputGate, l.rememberGate, l.outputGate, serializer.Bytes(initData), } return serializer.SerializeSlice(slist) }