MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / apply2

Method apply2

tensorpack/models/linearwrap.py:78–90  ·  view source on GitHub ↗

Apply a function on the wrapped tensor. The tensor will be the second argument of func. This is because many symbolic functions (such as tensorpack's layers) takes 'scope' as the first argument. Returns: LinearWrap: ``LinearWrap(func(args[0], se

(self, func, *args, **kwargs)

Source from the content-addressed store, hash-verified

76 return LinearWrap(ret)
77
78 def apply2(self, func, *args, **kwargs):
79 """
80 Apply a function on the wrapped tensor. The tensor
81 will be the second argument of func.
82
83 This is because many symbolic functions
84 (such as tensorpack's layers) takes 'scope' as the first argument.
85
86 Returns:
87 LinearWrap: ``LinearWrap(func(args[0], self.tensor(), *args[1:], **kwargs))``.
88 """
89 ret = func(args[0], self._t, *(args[1:]), **kwargs)
90 return LinearWrap(ret)
91
92 def __call__(self):
93 """

Callers 2

build_graphMethod · 0.80
get_logitsMethod · 0.80

Calls 1

LinearWrapClass · 0.85

Tested by

no test coverage detected