codomain = codomain.item() ords.append(domain) ords.append(codomain) return ords def pretty_repr(a): return('[[' + ','.join(list(map(lambda i: '{}'.format(i), a))) + ']]') if __name__ == '__main__': activation_fn = ACTIVATION_FNS[args.act] if args.arch == 'iresnet': dims = [2] + list(map(int, args.dims.split('-'))) + [2] blocks = [] if args.actnorm: blocks.append(layers.ActNorm1d(2)) for _ in range(args.nblocks): blocks.append( layers.iResBlock( build_nnet(dims, activation_fn), n_dist=args.n_dist, n_power_series=args.n_power_series, exact_trace=args.exact_trace, brute_force=args.brute_force, n_samples=args.n_samples, neumann_grad=False, grad_in_forward=False, ) ) if args.actnorm: blocks.append(layers.ActNorm1d(2))
def _actnorm(size, fc): if fc: return FCWrapper(layers.ActNorm1d(size[0] * size[1] * size[2])) else: return layers.ActNorm2d(size[0])
return ords def pretty_repr(a): return '[[' + ','.join(list(map(lambda i: f'{i:.2f}', a))) + ']]' if __name__ == '__main__': activation_fn = ACTIVATION_FNS[args.act] if args.arch == 'iresnet': dims = [2] + list(map(int, args.dims.split('-'))) + [2] blocks = [] if args.actnorm: blocks.append(layers.ActNorm1d(2)) for _ in range(args.nblocks): blocks.append( layers.iResBlock( build_nnet(dims, activation_fn), n_dist=args.n_dist, n_power_series=args.n_power_series, exact_trace=args.exact_trace, brute_force=args.brute_force, n_samples=args.n_samples, neumann_grad=False, grad_in_forward=False, )) if args.actnorm: blocks.append(layers.ActNorm1d(2)) if args.batchnorm: