Example #1
0
 def __repr__(self):
   return (
     "network metrics:\n" +
     "\tdata transmitted: {}\n".format(utils.bytes_to_string(self.bytes_transmitted)) +
     "\ttransmit utilization: {:.2f}%\n".format(self.transmit_utilization * 100) +
     "\teffective transmit throughput: {}/s ({}/s)\n".format(
       utils.bits_to_string(self.effective_transmit_throughput_Bps * 8),
       utils.bytes_to_string(self.effective_transmit_throughput_Bps))
   )
 def __repr__(self):
   return (
     "network metrics:\n" +
     "\tdata transmitted: {}\n".format(utils.bytes_to_string(self.bytes_transmitted)) +
     "\ttransmit utilization: {:.2f}%\n".format(self.transmit_utilization * 100) +
     "\teffective transmit throughput: {}/s ({}/s)\n".format(
       utils.bits_to_string(self.effective_transmit_throughput_Bps * 8),
       utils.bytes_to_string(self.effective_transmit_throughput_Bps))
   )
Example #3
0
 def decode(self, bits):
     result = { '__NAME': self.name }
     idx = 0
     for field in self.fields:
         name = field[0]
         length = field[1]
         value = bits[idx:idx+length]
         result[name] = bits_to_string(value, prefix=True)
         idx += length
     
     return result
Example #4
0
File: nn.py Project: Aranguri/nns
    def sample(self):
        sentence = self.task.train_x[np.random.randint(self.sizes[-1])]
        print(bits_to_string(sentence), end='|')

        for _ in range(1):
            self.Xs = [sentence]
            self.forward_pass()
            #char = np.random.choice(self.task.get_chars(), p=normalize(self.Xs[-1]))
            char = self.task.get_chars()[np.argmax(self.Xs[-1])]
            sentence = np.concatenate((sentence[8:], string_to_bits(char)))
            print(char, end='')
        print('\n\n')
Example #5
0
 def format(self, name, bits, chain_id, chip=None):
     return bits_to_string(bits)
Example #6
0
            if slice < 4:
                for x in range(1, 4):
                    name = "IOMUX%02i" % (slice + (4 * x))
                    bit_len = len(tile.values[name])
                    tile.encode(name, [0] * bit_len, bits, False)

#
# Write the ASC file
#
asc = open(sys.argv[2], 'w')
asc.write(".device 0x%x\n\n" % chip.device_id)

chain_idx = 0
for chain in bits_by_config:
    asc.write(".config_chain %i\n" % (chain_idx))
    asc.write(bits_to_string(bits_by_config[chain_idx]))
    asc.write("\n\n")
    chain_idx += 1

for tile_col in range(0, chip.columns):
    for tile_row in range(0, chip.rows):
        tile = chip.tile_at(tile_col, tile_row)
        if tile is None:
            continue
        asc.write(".%s %i %i\n" % (tile.type, tile_col, tile_row))
        bits = bits_by_tile[tile_col][tile_row]
        bit_idx = 0
        for bit_row in range(0, tile.bitstream_height):
            row_str = ""
            for bit_col in range(0, tile.bitstream_width):
                row_str += str(bits[bit_idx])