MCPcopy Index your code
hub / github.com/tensorlayer/TensorLayer / Model

Class Model

tensorlayer/models/core.py:21–983  ·  view source on GitHub ↗

The :class:`Model` class represents a neural network. It should be subclassed when implementing a dynamic model, where 'forward' method must be overwritten. Otherwise, please specify 'inputs' tensor(s) and 'outputs' tensor(s) to create a static model. In that case, 'inputs' tensors

Source from the content-addressed store, hash-verified

19
20
21class Model(object):
22 """The :class:`Model` class represents a neural network.
23
24 It should be subclassed when implementing a dynamic model,
25 where 'forward' method must be overwritten.
26 Otherwise, please specify 'inputs' tensor(s) and 'outputs' tensor(s)
27 to create a static model. In that case, 'inputs' tensors should come
28 from tl.layers.Input().
29
30 Parameters
31 -----------
32 inputs : a Layer or list of Layer
33 The input(s) to the model.
34 outputs : a Layer or list of Layer
35 The output(s) to the model.
36 name : None or str
37 The name of the model.
38
39 Methods
40 ---------
41 __init__(self, inputs=None, outputs=None, name=None)
42 Initializing the Model.
43 inputs()
44 Get input tensors to this network (only avaiable for static model).
45 outputs()
46 Get output tensors to this network (only avaiable for static model).
47 __call__(inputs, is_train=None, **kwargs)
48 Forward input tensors through this network.
49 all_layers()
50 Get all layer objects of this network in a list of layers.
51 weights()
52 Get the weights of this network in a list of tensors.
53 train()
54 Set this network in training mode. (affect layers e.g. Dropout, BatchNorm).
55 eval()
56 Set this network in evaluation mode.
57 as_layer()
58 Set this network as a ModelLayer so that it can be integrated into another Model.
59 release_memory()
60 Release the memory that was taken up by tensors which are maintained by this network.
61 save_weights(self, filepath, format='hdf5')
62 Save the weights of this network in a given format.
63 load_weights(self, filepath, format=None, in_order=True, skip=False)
64 Load weights into this network from a specified file.
65 save(self, filepath, save_weights=True)
66 Save the network with/without weights.
67 load(filepath, save_weights=True)
68 Load the network with/without weights.
69
70 Examples
71 ---------
72 >>> import tensorflow as tf
73 >>> import numpy as np
74 >>> from tensorlayer.layers import Input, Dense, Dropout
75 >>> from tensorlayer.models import Model
76
77 Define static model
78

Callers 15

static_graph2netFunction · 0.90
MobileNetV1Function · 0.90
VGG_staticFunction · 0.90
SqueezeNetV1Function · 0.90
ResNet50Function · 0.90
setUpClassMethod · 0.90
get_modelMethod · 0.90
get_unstack_modelMethod · 0.90
MyModelMethod · 0.90
test_ModelLayerMethod · 0.90
get_modelFunction · 0.90
get_model_batchnormFunction · 0.90

Calls

no outgoing calls

Tested by 15

setUpClassMethod · 0.72
get_modelMethod · 0.72
get_unstack_modelMethod · 0.72
MyModelMethod · 0.72
test_ModelLayerMethod · 0.72
basic_static_modelFunction · 0.68
setUpClassMethod · 0.68
setUpClassMethod · 0.68
test_layer_core_actMethod · 0.68
setUpClassMethod · 0.68
test_modellayerMethod · 0.68
test_layerlistMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…