# AOT ID: ['0_forward']
from ctypes import c_void_p, c_long, c_int
import torch
import math
import random
import os
import tempfile
from math import inf, nan
from torch._inductor.hooks import run_intermediate_hooks
from torch._inductor.utils import maybe_profile
from torch._inductor.codegen.memory_planning import _align as align
from torch import device, empty_strided
from torch._inductor.async_compile import AsyncCompile
from torch._inductor.select_algorithm import extern_kernels
from torch._inductor.codegen.multi_kernel import MultiKernelCall
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid, split_scan_grid, grid_combo_kernels, start_graph, end_graph
from torch._C import _cuda_getCurrentRawStream as get_raw_stream

aten = torch.ops.aten
inductor_ops = torch.ops.inductor
_quantized = torch.ops._quantized
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cpu = torch._C._dynamo.guards._empty_strided_cpu
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda
empty_strided_xpu = torch._C._dynamo.guards._empty_strided_xpu
reinterpret_tensor = torch._C._dynamo.guards._reinterpret_tensor
alloc_from_pool = torch.ops.inductor._alloc_from_pool
async_compile = AsyncCompile()


# kernel path: runs/run_shard_7/inductor_cache/ky/ckyxh3p6hkxueshgvojboo4jozq3hduwnw3g6qkvfaloiehxw3wa.py
# Topologically Sorted Source Nodes: [softplus, mul, x, tanh, tanh_1, mul_1, x_1, softplus_1, mul_2, x_2, tanh_2, tanh_3, mul_3, x_3, softplus_2, mul_4, x_4, tanh_4, tanh_5, mul_5, x_5, softplus_3, mul_6, add_6, sigmoid], Original ATen: [aten.softplus, aten.mul, aten.add, aten.tanh, aten.sigmoid]
# Source node to ATen node mapping:
#   add_6 => add_6
#   mul => mul
#   mul_1 => mul_1
#   mul_2 => mul_2
#   mul_3 => mul_3
#   mul_4 => mul_4
#   mul_5 => mul_5
#   mul_6 => mul_6
#   sigmoid => sigmoid
#   softplus => exp, gt, log1p, where
#   softplus_1 => exp_1, gt_1, log1p_1, where_1
#   softplus_2 => exp_2, gt_2, log1p_2, where_2
#   softplus_3 => exp_3, gt_3, log1p_3, where_3
#   tanh => tanh
#   tanh_1 => tanh_1
#   tanh_2 => tanh_2
#   tanh_3 => tanh_3
#   tanh_4 => tanh_4
#   tanh_5 => tanh_5
#   x => add
#   x_1 => add_1
#   x_2 => add_2
#   x_3 => add_3
#   x_4 => add_4
#   x_5 => add_5
# Graph fragment:
#   %exp : [num_users=1] = call_function[target=torch.ops.aten.exp.default](args = (%primals_1,), kwargs = {})
#   %log1p : [num_users=1] = call_function[target=torch.ops.aten.log1p.default](args = (%exp,), kwargs = {})
#   %gt : [num_users=1] = call_function[target=torch.ops.aten.gt.Scalar](args = (%primals_1, 20), kwargs = {})
#   %where : [num_users=1] = call_function[target=torch.ops.aten.where.self](args = (%gt, %primals_1, %log1p), kwargs = {})
#   %mul : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%primals_2, %where), kwargs = {})
#   %add : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%mul, %primals_3), kwargs = {})
#   %tanh : [num_users=1] = call_function[target=torch.ops.aten.tanh.default](args = (%add,), kwargs = {})
#   %tanh_1 : [num_users=1] = call_function[target=torch.ops.aten.tanh.default](args = (%primals_4,), kwargs = {})
#   %mul_1 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%tanh, %tanh_1), kwargs = {})
#   %add_1 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add, %mul_1), kwargs = {})
#   %exp_1 : [num_users=1] = call_function[target=torch.ops.aten.exp.default](args = (%primals_5,), kwargs = {})
#   %log1p_1 : [num_users=1] = call_function[target=torch.ops.aten.log1p.default](args = (%exp_1,), kwargs = {})
#   %gt_1 : [num_users=1] = call_function[target=torch.ops.aten.gt.Scalar](args = (%primals_5, 20), kwargs = {})
#   %where_1 : [num_users=1] = call_function[target=torch.ops.aten.where.self](args = (%gt_1, %primals_5, %log1p_1), kwargs = {})
#   %mul_2 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%add_1, %where_1), kwargs = {})
#   %add_2 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%mul_2, %primals_6), kwargs = {})
#   %tanh_2 : [num_users=1] = call_function[target=torch.ops.aten.tanh.default](args = (%add_2,), kwargs = {})
#   %tanh_3 : [num_users=1] = call_function[target=torch.ops.aten.tanh.default](args = (%primals_7,), kwargs = {})
#   %mul_3 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%tanh_2, %tanh_3), kwargs = {})
#   %add_3 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_2, %mul_3), kwargs = {})
#   %exp_2 : [num_users=1] = call_function[target=torch.ops.aten.exp.default](args = (%primals_8,), kwargs = {})
#   %log1p_2 : [num_users=1] = call_function[target=torch.ops.aten.log1p.default](args = (%exp_2,), kwargs = {})
#   %gt_2 : [num_users=1] = call_function[target=torch.ops.aten.gt.Scalar](args = (%primals_8, 20), kwargs = {})
#   %where_2 : [num_users=1] = call_function[target=torch.ops.aten.where.self](args = (%gt_2, %primals_8, %log1p_2), kwargs = {})
#   %mul_4 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%add_3, %where_2), kwargs = {})
#   %add_4 : [num_users=2] = call_function[target=torch.ops.aten.add.Tensor](args = (%mul_4, %primals_9), kwargs = {})
#   %tanh_4 : [num_users=1] = call_function[target=torch.ops.aten.tanh.default](args = (%add_4,), kwargs = {})
#   %tanh_5 : [num_users=1] = call_function[target=torch.ops.aten.tanh.default](args = (%primals_10,), kwargs = {})
#   %mul_5 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%tanh_4, %tanh_5), kwargs = {})
#   %add_5 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%add_4, %mul_5), kwargs = {})
#   %exp_3 : [num_users=1] = call_function[target=torch.ops.aten.exp.default](args = (%primals_11,), kwargs = {})
#   %log1p_3 : [num_users=1] = call_function[target=torch.ops.aten.log1p.default](args = (%exp_3,), kwargs = {})
#   %gt_3 : [num_users=1] = call_function[target=torch.ops.aten.gt.Scalar](args = (%primals_11, 20), kwargs = {})
#   %where_3 : [num_users=1] = call_function[target=torch.ops.aten.where.self](args = (%gt_3, %primals_11, %log1p_3), kwargs = {})
#   %mul_6 : [num_users=1] = call_function[target=torch.ops.aten.mul.Tensor](args = (%add_5, %where_3), kwargs = {})
#   %add_6 : [num_users=1] = call_function[target=torch.ops.aten.add.Tensor](args = (%mul_6, %primals_12), kwargs = {})
#   %sigmoid : [num_users=1] = call_function[target=torch.ops.aten.sigmoid.default](args = (%add_6,), kwargs = {})
triton_poi_fused_add_mul_sigmoid_softplus_tanh_0 = async_compile.triton('triton_poi_fused_add_mul_sigmoid_softplus_tanh_0', '''
import triton
import triton.language as tl
from triton.compiler.compiler import AttrsDescriptor

from torch._inductor.runtime import triton_helpers, triton_heuristics
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
from torch._inductor.runtime.hints import AutotuneHint, ReductionHint, TileHint, instance_descriptor, DeviceProperties

@triton_heuristics.pointwise(
    size_hints=[256], 
    filename=__file__,
    triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32', 3: '*fp32', 4: '*fp32', 5: '*fp32', 6: '*fp32', 7: '*fp32', 8: '*fp32', 9: '*fp32', 10: '*fp32', 11: '*fp32', 12: '*fp32', 13: 'i32'}, 'device': DeviceProperties(type='cuda', index=0, cc=80, major=8, regs_per_multiprocessor=65536, max_threads_per_multi_processor=2048, multi_processor_count=108), 'constants': {}, 'configs': [AttrsDescriptor(divisible_by_16=(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13), equal_to_1=())]},
    inductor_meta={'autotune_hints': set(), 'kernel_name': 'triton_poi_fused_add_mul_sigmoid_softplus_tanh_0', 'mutated_arg_names': ['in_out_ptr0'], 'no_x_dim': False, 'num_load': 12, 'num_reduction': 0, 'backend_hash': 'A9C866B4A14FD3277824029365D703C2427B2E685E54EC9B3EF4ADC8D1EEAC1D', 'are_deterministic_algorithms_enabled': False, 'assert_indirect_indexing': True, 'autotune_local_cache': True, 'autotune_pointwise': True, 'autotune_remote_cache': None, 'force_disable_caches': False, 'dynamic_scale_rblock': True, 'max_autotune': False, 'max_autotune_pointwise': False, 'min_split_scan_rblock': 256, 'spill_threshold': 16, 'store_cubin': False},
    min_elem_per_thread=0
)
@triton.jit
def triton_poi_fused_add_mul_sigmoid_softplus_tanh_0(in_out_ptr0, in_ptr0, in_ptr1, in_ptr2, in_ptr3, in_ptr4, in_ptr5, in_ptr6, in_ptr7, in_ptr8, in_ptr9, in_ptr10, in_ptr11, xnumel, XBLOCK : tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x0 = xindex % 4
    tmp0 = tl.load(in_ptr0 + (x2), xmask)
    tmp1 = tl.load(in_ptr1 + (x0), xmask, eviction_policy='evict_last')
    tmp8 = tl.load(in_ptr2 + (x0), xmask, eviction_policy='evict_last')
    tmp11 = tl.load(in_ptr3 + (x0), xmask, eviction_policy='evict_last')
    tmp15 = tl.load(in_ptr4 + (x0), xmask, eviction_policy='evict_last')
    tmp21 = tl.load(in_ptr5 + (x0), xmask, eviction_policy='evict_last')
    tmp24 = tl.load(in_ptr6 + (x0), xmask, eviction_policy='evict_last')
    tmp28 = tl.load(in_ptr7 + (x0), xmask, eviction_policy='evict_last')
    tmp34 = tl.load(in_ptr8 + (x0), xmask, eviction_policy='evict_last')
    tmp37 = tl.load(in_ptr9 + (x0), xmask, eviction_policy='evict_last')
    tmp41 = tl.load(in_ptr10 + (x0), xmask, eviction_policy='evict_last')
    tmp47 = tl.load(in_ptr11 + (x0), xmask, eviction_policy='evict_last')
    tmp2 = 20.0
    tmp3 = tmp1 > tmp2
    tmp4 = tl_math.exp(tmp1)
    tmp5 = libdevice.log1p(tmp4)
    tmp6 = tl.where(tmp3, tmp1, tmp5)
    tmp7 = tmp0 * tmp6
    tmp9 = tmp7 + tmp8
    tmp10 = libdevice.tanh(tmp9)
    tmp12 = libdevice.tanh(tmp11)
    tmp13 = tmp10 * tmp12
    tmp14 = tmp9 + tmp13
    tmp16 = tmp15 > tmp2
    tmp17 = tl_math.exp(tmp15)
    tmp18 = libdevice.log1p(tmp17)
    tmp19 = tl.where(tmp16, tmp15, tmp18)
    tmp20 = tmp14 * tmp19
    tmp22 = tmp20 + tmp21
    tmp23 = libdevice.tanh(tmp22)
    tmp25 = libdevice.tanh(tmp24)
    tmp26 = tmp23 * tmp25
    tmp27 = tmp22 + tmp26
    tmp29 = tmp28 > tmp2
    tmp30 = tl_math.exp(tmp28)
    tmp31 = libdevice.log1p(tmp30)
    tmp32 = tl.where(tmp29, tmp28, tmp31)
    tmp33 = tmp27 * tmp32
    tmp35 = tmp33 + tmp34
    tmp36 = libdevice.tanh(tmp35)
    tmp38 = libdevice.tanh(tmp37)
    tmp39 = tmp36 * tmp38
    tmp40 = tmp35 + tmp39
    tmp42 = tmp41 > tmp2
    tmp43 = tl_math.exp(tmp41)
    tmp44 = libdevice.log1p(tmp43)
    tmp45 = tl.where(tmp42, tmp41, tmp44)
    tmp46 = tmp40 * tmp45
    tmp48 = tmp46 + tmp47
    tmp49 = tl.sigmoid(tmp48)
    tl.store(in_out_ptr0 + (x2), tmp49, xmask)
''', device_str='cuda')


async_compile.wait(globals())
del async_compile

def call(args):
    primals_1, primals_2, primals_3, primals_4, primals_5, primals_6, primals_7, primals_8, primals_9, primals_10, primals_11, primals_12 = args
    args.clear()
    assert_size_stride(primals_1, (1, 4), (4, 1))
    assert_size_stride(primals_2, (4, 4, 4, 4), (64, 16, 4, 1))
    assert_size_stride(primals_3, (1, 4), (4, 1))
    assert_size_stride(primals_4, (1, 4), (4, 1))
    assert_size_stride(primals_5, (1, 4), (4, 1))
    assert_size_stride(primals_6, (1, 4), (4, 1))
    assert_size_stride(primals_7, (1, 4), (4, 1))
    assert_size_stride(primals_8, (1, 4), (4, 1))
    assert_size_stride(primals_9, (1, 4), (4, 1))
    assert_size_stride(primals_10, (1, 4), (4, 1))
    assert_size_stride(primals_11, (1, 4), (4, 1))
    assert_size_stride(primals_12, (1, 4), (4, 1))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        buf1 = buf0; del buf0  # reuse
        # Topologically Sorted Source Nodes: [softplus, mul, x, tanh, tanh_1, mul_1, x_1, softplus_1, mul_2, x_2, tanh_2, tanh_3, mul_3, x_3, softplus_2, mul_4, x_4, tanh_4, tanh_5, mul_5, x_5, softplus_3, mul_6, add_6, sigmoid], Original ATen: [aten.softplus, aten.mul, aten.add, aten.tanh, aten.sigmoid]
        stream0 = get_raw_stream(0)
        triton_poi_fused_add_mul_sigmoid_softplus_tanh_0.run(buf1, primals_2, primals_1, primals_3, primals_4, primals_5, primals_6, primals_7, primals_8, primals_9, primals_10, primals_11, primals_12, 256, grid=grid(256), stream=stream0)
        del primals_12
    return (buf1, primals_1, primals_2, primals_3, primals_4, primals_5, primals_6, primals_7, primals_8, primals_9, primals_10, primals_11, buf1, )


def benchmark_compiled_module(times=10, repeat=10):
    from torch._dynamo.testing import rand_strided
    from torch._inductor.utils import print_performance
    primals_1 = rand_strided((1, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_2 = rand_strided((4, 4, 4, 4), (64, 16, 4, 1), device='cuda:0', dtype=torch.float32)
    primals_3 = rand_strided((1, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_4 = rand_strided((1, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_5 = rand_strided((1, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_6 = rand_strided((1, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_7 = rand_strided((1, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_8 = rand_strided((1, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_9 = rand_strided((1, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_10 = rand_strided((1, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_11 = rand_strided((1, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    primals_12 = rand_strided((1, 4), (4, 1), device='cuda:0', dtype=torch.float32)
    fn = lambda: call([primals_1, primals_2, primals_3, primals_4, primals_5, primals_6, primals_7, primals_8, primals_9, primals_10, primals_11, primals_12])
    return print_performance(fn, times=times, repeat=repeat)


if __name__ == "__main__":
    from torch._inductor.wrapper_benchmark import compiled_module_main
    compiled_module_main('None', benchmark_compiled_module)

import torch
import torch.nn as nn
import torch.nn.functional as F


class Bitparm(nn.Module):
    """
    save params
    """

    def __init__(self, channel, final=False):
        super(Bitparm, self).__init__()
        self.final = final
        self.h = nn.Parameter(torch.nn.init.normal_(torch.empty(channel).
            view(1, -1), 0, 0.01))
        self.b = nn.Parameter(torch.nn.init.normal_(torch.empty(channel).
            view(1, -1), 0, 0.01))
        if not final:
            self.a = nn.Parameter(torch.nn.init.normal_(torch.empty(channel
                ).view(1, -1), 0, 0.01))
        else:
            self.a = None

    def forward(self, x):
        if self.final:
            return torch.sigmoid(x * F.softplus(self.h) + self.b)
        else:
            x = x * F.softplus(self.h) + self.b
            return x + torch.tanh(x) * torch.tanh(self.a)


class BitEstimator(nn.Module):
    """
    Estimate bit
    """

    def __init__(self, channel):
        super(BitEstimator, self).__init__()
        self.f1 = Bitparm(channel)
        self.f2 = Bitparm(channel)
        self.f3 = Bitparm(channel)
        self.f4 = Bitparm(channel, True)

    def forward(self, x):
        x = self.f1(x)
        x = self.f2(x)
        x = self.f3(x)
        return self.f4(x)


def get_inputs():
    return [torch.rand([4, 4, 4, 4])]


def get_init_inputs():
    return [[], {'channel': 4}]

import torch
import triton
import triton.language as tl
from torch._inductor.runtime.triton_heuristics import grid
from torch._C import _cuda_getCurrentRawStream as get_raw_stream
from torch._inductor.runtime.triton_helpers import libdevice, math as tl_math
import torch.nn as nn
import torch.nn.functional as F
assert_size_stride = torch._C._dynamo.guards.assert_size_stride
empty_strided_cuda = torch._C._dynamo.guards._empty_strided_cuda


@triton.jit
def triton_poi_fused_add_mul_sigmoid_softplus_tanh_0(in_out_ptr0, in_ptr0,
    in_ptr1, in_ptr2, in_ptr3, in_ptr4, in_ptr5, in_ptr6, in_ptr7, in_ptr8,
    in_ptr9, in_ptr10, in_ptr11, xnumel, XBLOCK: tl.constexpr):
    xnumel = 256
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = xindex < xnumel
    x2 = xindex
    x0 = xindex % 4
    tmp0 = tl.load(in_ptr0 + x2, xmask)
    tmp1 = tl.load(in_ptr1 + x0, xmask, eviction_policy='evict_last')
    tmp8 = tl.load(in_ptr2 + x0, xmask, eviction_policy='evict_last')
    tmp11 = tl.load(in_ptr3 + x0, xmask, eviction_policy='evict_last')
    tmp15 = tl.load(in_ptr4 + x0, xmask, eviction_policy='evict_last')
    tmp21 = tl.load(in_ptr5 + x0, xmask, eviction_policy='evict_last')
    tmp24 = tl.load(in_ptr6 + x0, xmask, eviction_policy='evict_last')
    tmp28 = tl.load(in_ptr7 + x0, xmask, eviction_policy='evict_last')
    tmp34 = tl.load(in_ptr8 + x0, xmask, eviction_policy='evict_last')
    tmp37 = tl.load(in_ptr9 + x0, xmask, eviction_policy='evict_last')
    tmp41 = tl.load(in_ptr10 + x0, xmask, eviction_policy='evict_last')
    tmp47 = tl.load(in_ptr11 + x0, xmask, eviction_policy='evict_last')
    tmp2 = 20.0
    tmp3 = tmp1 > tmp2
    tmp4 = tl_math.exp(tmp1)
    tmp5 = libdevice.log1p(tmp4)
    tmp6 = tl.where(tmp3, tmp1, tmp5)
    tmp7 = tmp0 * tmp6
    tmp9 = tmp7 + tmp8
    tmp10 = libdevice.tanh(tmp9)
    tmp12 = libdevice.tanh(tmp11)
    tmp13 = tmp10 * tmp12
    tmp14 = tmp9 + tmp13
    tmp16 = tmp15 > tmp2
    tmp17 = tl_math.exp(tmp15)
    tmp18 = libdevice.log1p(tmp17)
    tmp19 = tl.where(tmp16, tmp15, tmp18)
    tmp20 = tmp14 * tmp19
    tmp22 = tmp20 + tmp21
    tmp23 = libdevice.tanh(tmp22)
    tmp25 = libdevice.tanh(tmp24)
    tmp26 = tmp23 * tmp25
    tmp27 = tmp22 + tmp26
    tmp29 = tmp28 > tmp2
    tmp30 = tl_math.exp(tmp28)
    tmp31 = libdevice.log1p(tmp30)
    tmp32 = tl.where(tmp29, tmp28, tmp31)
    tmp33 = tmp27 * tmp32
    tmp35 = tmp33 + tmp34
    tmp36 = libdevice.tanh(tmp35)
    tmp38 = libdevice.tanh(tmp37)
    tmp39 = tmp36 * tmp38
    tmp40 = tmp35 + tmp39
    tmp42 = tmp41 > tmp2
    tmp43 = tl_math.exp(tmp41)
    tmp44 = libdevice.log1p(tmp43)
    tmp45 = tl.where(tmp42, tmp41, tmp44)
    tmp46 = tmp40 * tmp45
    tmp48 = tmp46 + tmp47
    tmp49 = tl.sigmoid(tmp48)
    tl.store(in_out_ptr0 + x2, tmp49, xmask)


def call(args):
    (primals_1, primals_2, primals_3, primals_4, primals_5, primals_6,
        primals_7, primals_8, primals_9, primals_10, primals_11, primals_12
        ) = args
    args.clear()
    assert_size_stride(primals_1, (1, 4), (4, 1))
    assert_size_stride(primals_2, (4, 4, 4, 4), (64, 16, 4, 1))
    assert_size_stride(primals_3, (1, 4), (4, 1))
    assert_size_stride(primals_4, (1, 4), (4, 1))
    assert_size_stride(primals_5, (1, 4), (4, 1))
    assert_size_stride(primals_6, (1, 4), (4, 1))
    assert_size_stride(primals_7, (1, 4), (4, 1))
    assert_size_stride(primals_8, (1, 4), (4, 1))
    assert_size_stride(primals_9, (1, 4), (4, 1))
    assert_size_stride(primals_10, (1, 4), (4, 1))
    assert_size_stride(primals_11, (1, 4), (4, 1))
    assert_size_stride(primals_12, (1, 4), (4, 1))
    with torch.cuda._DeviceGuard(0):
        torch.cuda.set_device(0)
        buf0 = empty_strided_cuda((4, 4, 4, 4), (64, 16, 4, 1), torch.float32)
        buf1 = buf0
        del buf0
        get_raw_stream(0)
        triton_poi_fused_add_mul_sigmoid_softplus_tanh_0[grid(256)](buf1,
            primals_2, primals_1, primals_3, primals_4, primals_5,
            primals_6, primals_7, primals_8, primals_9, primals_10,
            primals_11, primals_12, 256, XBLOCK=128, num_warps=4, num_stages=1)
        del primals_12
    return (buf1, primals_1, primals_2, primals_3, primals_4, primals_5,
        primals_6, primals_7, primals_8, primals_9, primals_10, primals_11,
        buf1)


class Bitparm(nn.Module):
    """
    save params
    """

    def __init__(self, channel, final=False):
        super(Bitparm, self).__init__()
        self.final = final
        self.h = nn.Parameter(torch.nn.init.normal_(torch.empty(channel).
            view(1, -1), 0, 0.01))
        self.b = nn.Parameter(torch.nn.init.normal_(torch.empty(channel).
            view(1, -1), 0, 0.01))
        if not final:
            self.a = nn.Parameter(torch.nn.init.normal_(torch.empty(channel
                ).view(1, -1), 0, 0.01))
        else:
            self.a = None

    def forward(self, x):
        if self.final:
            return torch.sigmoid(x * F.softplus(self.h) + self.b)
        else:
            x = x * F.softplus(self.h) + self.b
            return x + torch.tanh(x) * torch.tanh(self.a)


class BitEstimatorNew(nn.Module):
    """
    Estimate bit
    """

    def __init__(self, channel):
        super(BitEstimatorNew, self).__init__()
        self.f1 = Bitparm(channel)
        self.f2 = Bitparm(channel)
        self.f3 = Bitparm(channel)
        self.f4 = Bitparm(channel, True)

    def forward(self, input_0):
        primals_1 = self.f1.h
        primals_3 = self.f1.b
        primals_4 = self.f1.a
        primals_5 = self.f2.h
        primals_6 = self.f2.b
        primals_7 = self.f2.a
        primals_8 = self.f3.h
        primals_9 = self.f3.b
        primals_10 = self.f3.a
        primals_11 = self.f4.h
        primals_12 = self.f4.b
        primals_2 = input_0
        output = call([primals_1, primals_2, primals_3, primals_4,
            primals_5, primals_6, primals_7, primals_8, primals_9,
            primals_10, primals_11, primals_12])
        return output[0]
