Python chainer.function.Function() Examples
The following are 3
code examples of chainer.function.Function().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
chainer.function
, or try the search function
.
Example #1
Source File: caffe.py From chainer with MIT License | 6 votes |
def _get_layer_name(self, layer): """Generate layer name like "Convolution2DFunction-10-2". The first number means rank of the layer (depth from the top), and the second number is for preventing duplication (different layer objects can have same rank) Args: layer (~chainer.Function_node): Function object Returns: str: A string to be used for the ``name`` field of the graph in the exported Caffe model. """ label = '{}-{}'.format(layer.label, layer.rank) d = self.naming_map[label] if layer not in d.keys(): d[layer] = len(d) + 1 return '{}-{}'.format(label, d[layer])
Example #2
Source File: unary_math_function_test.py From chainer with MIT License | 5 votes |
def _func_name(func): if isinstance(func, function.Function): return func.__class__.__name__.lower() else: return func.__name__
Example #3
Source File: unary_math_function_test.py From chainer with MIT License | 5 votes |
def _func_class(func): if isinstance(func, function.Function): return func.__class__ else: name = func.__name__.capitalize() return getattr(functions, name, None)