| testBlocks |
| graph(%a : Tensor |
| %b : Tensor |
| %c : Tensor) { |
| %2 : int = prim::Constant[value=1]() |
| %3 : Tensor = aten::add(%a, %b, %2) |
| %5 : Tensor = prim::If(%c) |
| block0() { |
| %6 : int = prim::Constant[value=1]() |
| %7 : Tensor = aten::add(%3, %3, %6) |
| -> (%7) |
| } |
| block1() { |
| %8 : int = prim::Constant[value=1]() |
| %9 : Tensor = aten::add(%b, %3, %8) |
| %10 : int = prim::Constant[value=1]() |
| %11 : Tensor = aten::add(%9, %3, %10) |
| -> (%11) |
| } |
| %12 : int = prim::Constant[value=1]() |
| %13 : Tensor = aten::add(%5, %3, %12) |
| return (%13); |
| } |
| |
| graph(%a : Tensor |
| %b : Tensor |
| %c : Tensor) { |
| %2 : int = prim::Constant[value=1]() |
| %3 : Tensor = aten::add(%a, %b, %2) |
| %5 : Tensor = prim::If(%c) |
| block0() { |
| %8 : int = prim::Constant[value=1]() |
| %9 : Tensor = aten::add(%b, %3, %8) |
| %10 : int = prim::Constant[value=1]() |
| %11 : Tensor = aten::add(%9, %3, %10) |
| -> (%11) |
| } |
| %12 : int = prim::Constant[value=1]() |
| %13 : Tensor = aten::add(%5, %3, %12) |
| return (%13); |
| } |
| |
| graph(%a : Tensor |
| %b : Tensor |
| %c : Tensor) { |
| %3 : int = prim::Constant[value=1]() |
| %4 : Tensor = aten::add(%a, %b, %3) |
| %5 : Tensor = prim::If(%c) |
| block0() { |
| %6 : int = prim::Constant[value=1]() |
| %7 : Tensor = aten::add(%b, %4, %6) |
| %8 : int = prim::Constant[value=1]() |
| %9 : Tensor = aten::add(%7, %4, %8) |
| -> (%9) |
| } |
| %10 : int = prim::Constant[value=1]() |
| %11 : Tensor = aten::add(%5, %4, %10) |
| return (%11); |
| } |
| |
| testCreateAutodiffSubgraphs |
| graph(%0 : Tensor |
| %1 : Tensor |
| %2 : Tensor |
| %3 : Tensor |
| %4 : Tensor) { |
| %7 : int = prim::Constant[value=1]() |
| %23 : Tensor, %24 : Tensor = prim::DifferentiableGraph_0(%2, %1, %4, %0, %3) |
| return (%23, %24); |
| } |
| with prim::DifferentiableGraph_0 = graph(%13 : Tensor |
| %32 : Tensor |
| %33 : Tensor |
| %35 : Tensor |
| %36 : Tensor) { |
| %37 : Tensor = aten::mm(%35, %36) |
| %34 : Tensor = aten::mm(%32, %33) |
| %30 : int = prim::Constant[value=1]() |
| %31 : Tensor = aten::add(%37, %34, %30) |
| %24 : Tensor, %25 : Tensor, %26 : Tensor, %27 : Tensor = prim::ConstantChunk[chunks=4, dim=1](%31) |
| %22 : Tensor = aten::sigmoid(%24) |
| %20 : Tensor = aten::sigmoid(%27) |
| %18 : Tensor = aten::tanh(%26) |
| %16 : Tensor = aten::sigmoid(%25) |
| %14 : Tensor = aten::mul(%16, %13) |
| %11 : Tensor = aten::mul(%22, %18) |
| %8 : Tensor = aten::add(%14, %11, %30) |
| %4 : Tensor = aten::tanh(%8) |
| %2 : Tensor = aten::mul(%20, %4) |
| return (%2, %8); |
| } |
| |
| testDifferentiate |
| graph(%0 : Float(2, 3, 4) |
| %1 : Float(2, 3, 4)) { |
| %2 : Float(2, 3, 4) = aten::mul(%0, %1) |
| %3 : Float(2, 3, 4) = aten::mul(%2, %0) |
| %4 : int = prim::Constant[value=1]() |
| %7 : int[] = aten::size(%3) |
| %5 : Float(2, 3, 4) = aten::add(%3, %1, %4) |
| return (%5, %2, %7); |
| } |
| graph(%0 : Float(2, 3, 4) |
| %1 : Float(2, 3, 4) |
| %2 : Float(2, 3, 4) |
| %3 : Float(2, 3, 4) |
| %4 : Float(2, 3, 4) |
| %5 : int[]) { |
| %9 : int = prim::Constant[value=1]() |
| %6 : int[] = aten::size(%4) |
| %7 : int[] = aten::size(%3) |
| %8 : int[] = aten::size(%2) |
| %10 : Tensor, %11 : Tensor = prim::GradOf[name="aten::add"](%0) |
| block0() { |
| %12 : Tensor = prim::SumToSize(%0, %5) |
| %13 : Float(2, 3, 4) = aten::mul(%0, %9) |
| %14 : Tensor = prim::SumToSize(%13, %7) |
| -> (%12, %14) |
| } |
| %15 : Tensor, %16 : Tensor = prim::GradOf[name="aten::mul"](%10) |
| block0() { |
| %17 : Tensor = aten::mul(%10, %2) |
| %18 : Tensor = prim::SumToSize(%17, %6) |
| %19 : Tensor = aten::mul(%10, %4) |
| %20 : Tensor = prim::SumToSize(%19, %8) |
| -> (%18, %20) |
| } |
| %21 : Tensor = prim::AutogradAdd(%1, %15) |
| %22 : Tensor, %23 : Tensor = prim::GradOf[name="aten::mul"](%21) |
| block0() { |
| %24 : Tensor = aten::mul(%21, %3) |
| %25 : Tensor = prim::SumToSize(%24, %8) |
| %26 : Tensor = aten::mul(%21, %2) |
| %27 : Tensor = prim::SumToSize(%26, %7) |
| -> (%25, %27) |
| } |
| %28 : Tensor = prim::AutogradAdd(%16, %22) |
| %29 : Tensor = prim::AutogradAdd(%11, %23) |
| return (%28, %29); |
| } |
| |
| testDifferentiateWithRequiresGrad |
| graph(%0 : Float(*) |
| %1 : Float(*)) { |
| %2 : Float(*) = aten::mul(%1, %1) |
| %3 : int = prim::Constant[value=1]() |
| %4 : Float(*) = aten::add(%2, %1, %3) |
| %26 : int[] = aten::size(%4) |
| %6 : Float(*) = aten::add(%4, %0, %3) |
| %7 : Float(*) = aten::mul(%6, %0) |
| %11 : int[] = aten::size(%7) |
| %14 : int[] = aten::size(%1) |
| %9 : Float(*) = aten::add(%7, %1, %3) |
| return (%4, %9, %26, %6, %11, %14); |
| } |
| graph(%0 : Float(*) |
| %1 : Float(*) |
| %2 : Float(*) |
| %3 : int[] |
| %4 : Float(*) |
| %5 : int[] |
| %6 : int[]) { |
| %9 : int = prim::Constant[value=1]() |
| %7 : int[] = aten::size(%4) |
| %8 : int[] = aten::size(%2) |
| %11 : Tensor, %12 : Tensor = prim::GradOf[name="aten::add"](%0) |
| block0() { |
| %13 : Tensor = prim::SumToSize(%0, %5) |
| %14 : Tensor = aten::mul(%0, %9) |
| %15 : Tensor = prim::SumToSize(%14, %6) |
| -> (%13, %15) |
| } |
| %16 : Tensor, %17 : Tensor = prim::GradOf[name="aten::mul"](%11) |
| block0() { |
| %18 : Tensor = aten::mul(%11, %2) |
| %19 : Tensor = prim::SumToSize(%18, %7) |
| %20 : Tensor = aten::mul(%11, %4) |
| %21 : Tensor = prim::SumToSize(%20, %8) |
| -> (%19, %21) |
| } |
| %22 : Tensor = prim::AutogradAdd(%1, %16) |
| %23 : Tensor, %24 : Tensor = prim::GradOf[name="aten::add"](%22) |
| block0() { |
| %25 : Tensor = prim::SumToSize(%22, %3) |
| %26 : Tensor = aten::mul(%22, %9) |
| %27 : Tensor = prim::SumToSize(%26, %8) |
| -> (%25, %27) |
| } |
| %28 : Tensor = prim::AutogradAdd(%17, %24) |
| return (%28); |
| } |
| |