import unittest
from caffe2.proto import caffe2_pb2
import caffe2.python.cnn as cnn
import caffe2.python.core as core
import caffe2.contrib.tensorboard.tensorboard_exporter as tb
EXPECTED = """
node {
name: "conv1/XavierFill"
op: "XavierFill"
device: "/gpu:0"
attr {
key: "_output_shapes"
value {
list {
shape {
dim {
size: 96
}
dim {
size: 3
}
dim {
size: 11
}
dim {
size: 11
}
}
}
}
}
}
node {
name: "conv1/ConstantFill"
op: "ConstantFill"
device: "/gpu:0"
attr {
key: "_output_shapes"
value {
list {
shape {
dim {
size: 96
}
}
}
}
}
}
node {
name: "classifier/XavierFill"
op: "XavierFill"
device: "/gpu:0"
attr {
key: "_output_shapes"
value {
list {
shape {
dim {
size: 1000
}
dim {
size: 4096
}
}
}
}
}
}
node {
name: "classifier/ConstantFill"
op: "ConstantFill"
device: "/gpu:0"
attr {
key: "_output_shapes"
value {
list {
shape {
dim {
size: 1000
}
}
}
}
}
}
node {
name: "ImageInput"
op: "ImageInput"
input: "db"
device: "/gpu:0"
attr {
key: "cudnn_exhaustive_search"
value {
i: 0
}
}
attr {
key: "is_test"
value {
i: 0
}
}
attr {
key: "use_cudnn"
value {
i: 1
}
}
}
node {
name: "NHWC2NCHW"
op: "NHWC2NCHW"
input: "data_nhwc"
device: "/gpu:0"
}
node {
name: "conv1/Conv"
op: "Conv"
input: "data"
input: "conv1/conv1_w"
input: "conv1/conv1_b"
device: "/gpu:0"
attr {
key: "exhaustive_search"
value {
i: 0
}
}
attr {
key: "kernel"
value {
i: 11
}
}
attr {
key: "order"
value {
s: "NCHW"
}
}
attr {
key: "stride"
value {
i: 4
}
}
}
node {
name: "conv1/Relu"
op: "Relu"
input: "conv1/conv1"
device: "/gpu:0"
attr {
key: "cudnn_exhaustive_search"
value {
i: 0
}
}
attr {
key: "order"
value {
s: "NCHW"
}
}
}
node {
name: "conv1/MaxPool"
op: "MaxPool"
input: "conv1/conv1_1"
device: "/gpu:0"
attr {
key: "cudnn_exhaustive_search"
value {
i: 0
}
}
attr {
key: "kernel"
value {
i: 2
}
}
attr {
key: "order"
value {
s: "NCHW"
}
}
attr {
key: "stride"
value {
i: 2
}
}
}
node {
name: "classifier/FC"
op: "FC"
input: "conv1/pool1"
input: "classifier/fc_w"
input: "classifier/fc_b"
device: "/gpu:0"
attr {
key: "cudnn_exhaustive_search"
value {
i: 0
}
}
attr {
key: "order"
value {
s: "NCHW"
}
}
attr {
key: "use_cudnn"
value {
i: 1
}
}
}
node {
name: "classifier/Softmax"
op: "Softmax"
input: "classifier/fc"
device: "/gpu:0"
attr {
key: "cudnn_exhaustive_search"
value {
i: 0
}
}
attr {
key: "order"
value {
s: "NCHW"
}
}
}
node {
name: "classifier/LabelCrossEntropy"
op: "LabelCrossEntropy"
input: "classifier/pred"
input: "label"
device: "/gpu:0"
}
node {
name: "classifier/AveragedLoss"
op: "AveragedLoss"
input: "classifier/xent"
device: "/gpu:0"
}
node {
name: "GRADIENTS/classifier/ConstantFill"
op: "ConstantFill"
input: "classifier/loss"
device: "/gpu:0"
attr {
key: "value"
value {
f: 1.0
}
}
}
node {
name: "GRADIENTS/classifier/AveragedLossGradient"
op: "AveragedLossGradient"
input: "classifier/xent"
input: "GRADIENTS/classifier/loss_autogen_grad"
device: "/gpu:0"
}
node {
name: "GRADIENTS/classifier/LabelCrossEntropyGradient"
op: "LabelCrossEntropyGradient"
input: "classifier/pred"
input: "label"
input: "GRADIENTS/classifier/xent_grad"
device: "/gpu:0"
}
node {
name: "GRADIENTS/classifier/SoftmaxGradient"
op: "SoftmaxGradient"
input: "classifier/pred"
input: "GRADIENTS/classifier/pred_grad"
device: "/gpu:0"
attr {
key: "cudnn_exhaustive_search"
value {
i: 0
}
}
attr {
key: "order"
value {
s: "NCHW"
}
}
}
node {
name: "GRADIENTS/c/FCGradient"
op: "FCGradient"
input: "conv1/pool1"
input: "classifier/fc_w"
input: "GRADIENTS/classifier/fc_grad"
device: "/gpu:0"
attr {
key: "cudnn_exhaustive_search"
value {
i: 0
}
}
attr {
key: "order"
value {
s: "NCHW"
}
}
attr {
key: "use_cudnn"
value {
i: 1
}
}
}
node {
name: "GRADIENTS/conv1/MaxPoolGradient"
op: "MaxPoolGradient"
input: "conv1/conv1_1"
input: "conv1/pool1"
input: "GRADIENTS/conv1/pool1_grad"
device: "/gpu:0"
attr {
key: "cudnn_exhaustive_search"
value {
i: 0
}
}
Loading ...