# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 2
#     language: python
#     name: python2
# ---

# +
import _init_paths
import caffe
import numpy as np

caffe.set_mode_cpu()
# -

net = caffe.Net('./res18_part.prototxt', caffe.TEST)

print '--->net\n', net

print '--->net.layer_dict\n', net.layer_dict
print '--->net.layers\n', net.layers

print '--->net.inputs\n', net.inputs
print '--->net.blobs\n', net.blobs
print '--->net.params\n', net.params

print '--->net.bottom_names\n', net.bottom_names
print '--->net.top_names\n', net.top_names

for layer in net.layers:
    print '--->layer\n', layer
    print '     layer.type: ', layer.type
    print '     layer.blobs: ', layer.blobs
    
    for blob in layer.blobs:
        print '       blob: ', blob
        print '       blob.shape: ', blob.shape
        print '       blob.shape: ', np.array(blob.shape)

for name,blob in net.blobs.iteritems():
        print '--->blob name: ', name
        print '       blob: ', blob
        print '       blob.shape: ', blob.shape
        print '       blob.shape: ', np.array(blob.shape)

for layer, param_blobs in net.params.iteritems():
    print '---> layer: ', layer
    print ' num of param_blob: ', len(param_blobs)
    
    for i, blob in enumerate(param_blobs):
        print '    shape of param blob #%d: ' % i, np.array(blob.shape)



StarcoderdataJupyterScriptsDedupFiltered