Skip to content

Instantly share code, notes, and snippets.

@dan-zheng
Last active January 13, 2020 13:51
Show Gist options
  • Save dan-zheng/23cb8a937be18967600e127e4f32e85a to your computer and use it in GitHub Desktop.
Save dan-zheng/23cb8a937be18967600e127e4f32e85a to your computer and use it in GitHub Desktop.
Debug tensorflow/swift-apis compilation time

tensorflow/swift-apis compilation is painfully slow. It's probably due to type-checking.

Swift compilation debugging tips here. swift build -Xswiftc -Xfrontend -Xswiftc -debug-time-function-bodies results below.

# Worst offenders, time in milliseconds.
(1767, "global function 'gelu'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:1225:13')
(1767, "global function 'gelu'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:1225:13')
(1767, "global function 'gelu'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:1225:13')
(1866, "instance method 'sha512()'", '/Users/danielzheng/swift-apis/Sources/Tensor/TensorUtilities.swift:149:10')
(2220, "instance method 'update(_:along:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Optimizers/MomentumBased.swift:152:17')
(2220, "instance method 'update(_:along:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Optimizers/MomentumBased.swift:152:17')
(2220, "instance method 'update(_:along:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Optimizers/MomentumBased.swift:152:17')
(2304, "global function 'root'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:1375:13')
(2304, "global function 'root'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:1375:13')
(2304, "global function 'root'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:1375:13')
(2528, "global function 'hingeLoss(predicted:expected:reduction:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Loss.swift:109:13')
(2528, "global function 'hingeLoss(predicted:expected:reduction:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Loss.swift:109:13')
(2528, "global function 'hingeLoss(predicted:expected:reduction:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Loss.swift:109:13')
(3796, "global function 'categoricalHingeLoss(predicted:expected:reduction:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Loss.swift:139:13')
(3796, "global function 'categoricalHingeLoss(predicted:expected:reduction:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Loss.swift:139:13')
(3796, "global function 'categoricalHingeLoss(predicted:expected:reduction:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Loss.swift:139:13')
(4102, "instance method 'update(_:along:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Optimizers/MomentumBased.swift:429:17')
(4102, "instance method 'update(_:along:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Optimizers/MomentumBased.swift:429:17')
(4102, "instance method 'update(_:along:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Optimizers/MomentumBased.swift:429:17')
(4128, "global function 'cosineSimilarity'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:1492:13')
(4128, "global function 'cosineSimilarity'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:1492:13')
(4128, "global function 'cosineSimilarity'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:1492:13')
(15152, "global function 'logCoshLoss(predicted:expected:reduction:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Loss.swift:157:13')
(15152, "global function 'logCoshLoss(predicted:expected:reduction:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Loss.swift:157:13')
(15152, "global function 'logCoshLoss(predicted:expected:reduction:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Loss.swift:157:13')
public func logCoshLoss<Scalar: TensorFlowFloatingPoint>(
    predicted: Tensor<Scalar>,
    expected: Tensor<Scalar>,
    reduction: @differentiable (Tensor<Scalar>) -> Tensor<Scalar> = _mean
) -> Tensor<Scalar> {
    let x = predicted - expected
    return reduction(x + softplus(Tensor(-2) * x) - log(Tensor(2)))
}

swift build -Xswiftc -Xfrontend -Xswiftc -debug-time-compilation didn't print any output for me for some reason.


Idea from @allevato: provide a contextual type for integer/float literals to help the type-checker.

It works:

import TensorFlow

@differentiable
public func logCoshLoss<Scalar: TensorFlowFloatingPoint>(
    predicted: Tensor<Scalar>,
    expected: Tensor<Scalar>,
    reduction: @differentiable (Tensor<Scalar>) -> Tensor<Scalar> = _mean
) -> Tensor<Scalar> {
    let x = predicted - expected
    // Original code.
    return reduction(x + softplus(Tensor(-2) * x) - log(Tensor(2)))
}

@differentiable
public func logCoshLossTest<Scalar: TensorFlowFloatingPoint>(
    predicted: Tensor<Scalar>,
    expected: Tensor<Scalar>,
    reduction: @differentiable (Tensor<Scalar>) -> Tensor<Scalar> = _mean
) -> Tensor<Scalar> {
    let x = predicted - expected
    // Tony's suggestion: provide contextual type for literals.
    return reduction(x + softplus(Tensor(-2 as Scalar) * x) - log(Tensor(2 as Scalar)))
}
$ swift -Xfrontend -debug-time-function-bodies timing.swift
timing.swift:4:13: warning: global function 'logCoshLoss(predicted:expected:reduction:)' took 7400ms to type-check (limit: 1ms)
public func logCoshLoss<Scalar: TensorFlowFloatingPoint>(
            ^
timing.swift:15:13: warning: global function 'logCoshLossTest(predicted:expected:reduction:)' took 134ms to type-check (limit: 1ms)
public func logCoshLossTest<Scalar: TensorFlowFloatingPoint>(
            ^

I believe this should not be necessary, and may be a deficiency in the Swift type checker, specifically bidirectional type-checking and constraint propagation. When a contextual type exists, constraints should propagate from outer->inner: so Scalar is the only possible type for the literals 2 and -2 in logCoshLoss. Inner->outer propagation results in a huge disjunction constraint and huge slowdown.

I'm not sure why exactly logCoshLoss takes so long to type-check. I plan to write a minimal reproducer and ask on the forums.


Suggestion from @rxwei: splitting tensorflow/swift-apis into more files can help multithreaded compilation, since one thread is spawned per file. Some files like Math.swift are huge and can be split.

#!/usr/bin/env python
# Sorts and prints the output of `swiftc -Xfrontend -debug-time-function-bodies`.
# Minimal time threshold in milliseconds.
MIN_TIME_THRESHOLD = 50
import re
import sys
pattern = re.compile('(.+): warning: (.+) took ([0-9]+)ms to type-check')
entries = []
filename = sys.argv[1]
with open(filename) as f:
for line in f:
match = pattern.match(line)
if not match:
continue
location = match.group(1)
declaration = match.group(2)
time = match.group(3)
entries.append((int(time), declaration, location))
# print('{} {} {}'.format(time, declaration, location))
# Keep entries above the minimal time threshold.
entries = filter(lambda x: int(x[0]) > 50, entries)
# Sort entries by time, descending order.
entries.sort(key=lambda x: -x[0])
for entry in entries:
print(entry)
(15152, "global function 'logCoshLoss(predicted:expected:reduction:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Loss.swift:157:13')
(15152, "global function 'logCoshLoss(predicted:expected:reduction:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Loss.swift:157:13')
(15152, "global function 'logCoshLoss(predicted:expected:reduction:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Loss.swift:157:13')
(4128, "global function 'cosineSimilarity'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:1492:13')
(4128, "global function 'cosineSimilarity'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:1492:13')
(4128, "global function 'cosineSimilarity'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:1492:13')
(4102, "instance method 'update(_:along:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Optimizers/MomentumBased.swift:429:17')
(4102, "instance method 'update(_:along:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Optimizers/MomentumBased.swift:429:17')
(4102, "instance method 'update(_:along:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Optimizers/MomentumBased.swift:429:17')
(3796, "global function 'categoricalHingeLoss(predicted:expected:reduction:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Loss.swift:139:13')
(3796, "global function 'categoricalHingeLoss(predicted:expected:reduction:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Loss.swift:139:13')
(3796, "global function 'categoricalHingeLoss(predicted:expected:reduction:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Loss.swift:139:13')
(2528, "global function 'hingeLoss(predicted:expected:reduction:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Loss.swift:109:13')
(2528, "global function 'hingeLoss(predicted:expected:reduction:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Loss.swift:109:13')
(2528, "global function 'hingeLoss(predicted:expected:reduction:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Loss.swift:109:13')
(2304, "global function 'root'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:1375:13')
(2304, "global function 'root'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:1375:13')
(2304, "global function 'root'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:1375:13')
(2220, "instance method 'update(_:along:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Optimizers/MomentumBased.swift:152:17')
(2220, "instance method 'update(_:along:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Optimizers/MomentumBased.swift:152:17')
(2220, "instance method 'update(_:along:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Optimizers/MomentumBased.swift:152:17')
(1866, "instance method 'sha512()'", '/Users/danielzheng/swift-apis/Sources/Tensor/TensorUtilities.swift:149:10')
(1767, "global function 'gelu'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:1225:13')
(1767, "global function 'gelu'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:1225:13')
(1767, "global function 'gelu'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:1225:13')
(1515, "instance method 'update(_:along:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Optimizers/MomentumBased.swift:57:17')
(1515, "instance method 'update(_:along:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Optimizers/MomentumBased.swift:57:17')
(1515, "instance method 'update(_:along:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Optimizers/MomentumBased.swift:57:17')
(1377, "global function 'huberLoss(predicted:expected:delta:reduction:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Loss.swift:302:13')
(1377, "global function 'huberLoss(predicted:expected:delta:reduction:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Loss.swift:302:13')
(1377, "global function 'huberLoss(predicted:expected:delta:reduction:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Loss.swift:302:13')
(1170, "instance method 'update(_:along:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Optimizers/MomentumBased.swift:208:17')
(1170, "instance method 'update(_:along:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Optimizers/MomentumBased.swift:208:17')
(1170, "instance method 'update(_:along:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Optimizers/MomentumBased.swift:208:17')
(1161, "instance method 'update(_:along:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Optimizers/MomentumBased.swift:350:17')
(1161, "instance method 'update(_:along:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Optimizers/MomentumBased.swift:350:17')
(1161, "instance method 'update(_:along:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Optimizers/MomentumBased.swift:350:17')
(1153, "instance method 'update(_:along:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Optimizers/MomentumBased.swift:273:17')
(1153, "instance method 'update(_:along:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Optimizers/MomentumBased.swift:273:17')
(1153, "instance method 'update(_:along:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Optimizers/MomentumBased.swift:273:17')
(1107, "global function 'sigmoidCrossEntropy(logits:labels:reduction:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Loss.swift:276:13')
(1107, "global function 'sigmoidCrossEntropy(logits:labels:reduction:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Loss.swift:276:13')
(1107, "global function 'sigmoidCrossEntropy(logits:labels:reduction:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Loss.swift:276:13')
(876, "global function 'meanAbsolutePercentageError(predicted:expected:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Loss.swift:95:13')
(876, "global function 'meanAbsolutePercentageError(predicted:expected:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Loss.swift:95:13')
(876, "global function 'meanAbsolutePercentageError(predicted:expected:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Loss.swift:95:13')
(819, "static method '_vjpDivide(lhs:rhs:)'", '/Users/danielzheng/swift-apis/Sources/third_party/Experimental/Complex.swift:321:17')
(810, "instance method 'batchNormalized(alongAxis:offset:scale:epsilon:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/NN.swift:32:10')
(810, "instance method 'batchNormalized(alongAxis:offset:scale:epsilon:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/NN.swift:32:10')
(810, "instance method 'batchNormalized(alongAxis:offset:scale:epsilon:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/NN.swift:32:10')
(622, "operator function '/'", '/Users/danielzheng/swift-apis/Sources/third_party/Experimental/Complex.swift:214:17')
(592, "static method '_vjpDivide(lhs:rhs:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:501:17')
(592, "static method '_vjpDivide(lhs:rhs:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:501:17')
(592, "static method '_vjpDivide(lhs:rhs:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:501:17')
(584, "static method '_vjpDivide(lhs:rhs:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:511:17')
(584, "static method '_vjpDivide(lhs:rhs:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:511:17')
(584, "static method '_vjpDivide(lhs:rhs:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:511:17')
(535, "instance method 'callAsFunction'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Layers/Normalization.swift:73:17')
(535, "instance method 'callAsFunction'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Layers/Normalization.swift:73:17')
(535, "instance method 'callAsFunction'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Layers/Normalization.swift:73:17')
(514, "instance method 'update(_:along:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Optimizers/SGD.swift:54:17')
(514, "instance method 'update(_:along:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Optimizers/SGD.swift:54:17')
(514, "instance method 'update(_:along:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Optimizers/SGD.swift:54:17')
(509, "instance method 'sha1()'", '/Users/danielzheng/swift-apis/Sources/Tensor/TensorUtilities.swift:54:10')
(484, "initializer 'init(shape:scalars:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/StringTensor.swift:41:5')
(484, "initializer 'init(shape:scalars:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/StringTensor.swift:41:5')
(484, "initializer 'init(shape:scalars:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/StringTensor.swift:41:5')
(454, "operator function '*'", '/Users/danielzheng/swift-apis/Sources/third_party/Experimental/Complex.swift:159:17')
(450, "static method 'handleMultiplyNaN(infiniteA:infiniteB:nanA:nanB:)'", '/Users/danielzheng/swift-apis/Sources/third_party/Experimental/Complex.swift:140:25')
(401, "instance method 'callAsFunction'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Layers/Upsampling.swift:32:17')
(401, "instance method 'callAsFunction'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Layers/Upsampling.swift:32:17')
(401, "instance method 'callAsFunction'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Layers/Upsampling.swift:32:17')
(368, "instance method 'valueWithGradient(in:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/DifferentialOperators.swift:36:10')
(368, "instance method 'valueWithGradient(in:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/DifferentialOperators.swift:36:10')
(368, "instance method 'valueWithGradient(in:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/DifferentialOperators.swift:36:10')
(368, "instance method 'valueWithGradient(in:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/DifferentialOperators.swift:36:10')
(361, "initializer 'init(numpy:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/PythonConversion.swift:98:12')
(361, "initializer 'init(numpy:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/PythonConversion.swift:98:12')
(361, "initializer 'init(numpy:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/PythonConversion.swift:98:12')
(361, "initializer 'init(numpy:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/PythonConversion.swift:98:12')
(333, "initializer 'init(numpy:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/PythonConversion.swift:35:12')
(333, "initializer 'init(numpy:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/PythonConversion.swift:35:12')
(333, "initializer 'init(numpy:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/PythonConversion.swift:35:12')
(333, "initializer 'init(numpy:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/PythonConversion.swift:35:12')
(332, "initializer 'init(_:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/TensorHandle.swift:290:5')
(332, "initializer 'init(_:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/TensorHandle.swift:290:5')
(332, "initializer 'init(_:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/TensorHandle.swift:290:5')
(324, "global function 'meanSquaredLogarithmicError(predicted:expected:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Loss.swift:80:13')
(324, "global function 'meanSquaredLogarithmicError(predicted:expected:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Loss.swift:80:13')
(324, "global function 'meanSquaredLogarithmicError(predicted:expected:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Loss.swift:80:13')
(270, "initializer 'init(randomUniform:lowerBound:upperBound:seed:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Initializers.swift:407:5')
(270, "initializer 'init(randomUniform:lowerBound:upperBound:seed:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Initializers.swift:407:5')
(270, "initializer 'init(randomUniform:lowerBound:upperBound:seed:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Initializers.swift:407:5')
(265, "global function 'makeTensor(dataType:owning:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/DataTypes.swift:32:15')
(265, "global function 'makeTensor(dataType:owning:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/DataTypes.swift:32:15')
(265, "global function 'makeTensor(dataType:owning:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/DataTypes.swift:32:15')
(265, "global function 'makeTensor(dataType:owning:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/DataTypes.swift:32:15')
(265, "operator function '.<'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Comparison.swift:50:17')
(265, "operator function '.<'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Comparison.swift:50:17')
(265, "operator function '.<'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Comparison.swift:50:17')
(258, "instance method 'updateOutputShapes()'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/LazyTensorShapeInference.swift:46:10')
(258, "instance method 'updateOutputShapes()'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/LazyTensorShapeInference.swift:46:10')
(258, "instance method 'updateOutputShapes()'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/LazyTensorShapeInference.swift:46:10')
(258, "instance method 'updateOutputShapes()'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/LazyTensorShapeInference.swift:46:10')
(253, "initializer 'init(vocabularySize:embeddingSize:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Layers/Embedding.swift:31:12')
(253, "initializer 'init(vocabularySize:embeddingSize:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Layers/Embedding.swift:31:12')
(253, "initializer 'init(vocabularySize:embeddingSize:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Layers/Embedding.swift:31:12')
(234, "initializer 'init(inputSize:hiddenSize:seed:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Layers/Recurrent.swift:114:12')
(234, "initializer 'init(inputSize:hiddenSize:seed:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Layers/Recurrent.swift:114:12')
(234, "initializer 'init(inputSize:hiddenSize:seed:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Layers/Recurrent.swift:114:12')
(216, "instance method '_vjpScalarized()'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/Tensor.swift:139:10')
(216, "instance method '_vjpScalarized()'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/Tensor.swift:139:10')
(216, "instance method '_vjpScalarized()'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/Tensor.swift:139:10')
(175, "global function 'randomSeedForTensorFlow(using:)'", '/Users/danielzheng/swift-apis/Sources/Tensor/Random.swift:24:13')
(166, "operator function '+'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:263:17')
(166, "operator function '+'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:263:17')
(166, "operator function '+'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:263:17')
(150, "static method '_vjpConcatenating(concatenating:alongAxis:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Initializers.swift:211:17')
(150, "static method '_vjpConcatenating(concatenating:alongAxis:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Initializers.swift:211:17')
(150, "static method '_vjpConcatenating(concatenating:alongAxis:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Initializers.swift:211:17')
(145, "instance method 'repeatingElements(_:alongAxis:count:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Layers/Upsampling.swift:83:18')
(145, "instance method 'repeatingElements(_:alongAxis:count:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Layers/Upsampling.swift:83:18')
(145, "instance method 'repeatingElements(_:alongAxis:count:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Layers/Upsampling.swift:83:18')
(143, "initializer 'init(repeating:shape:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Initializers.swift:38:5')
(143, "initializer 'init(repeating:shape:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Initializers.swift:38:5')
(143, "initializer 'init(repeating:shape:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Initializers.swift:38:5')
(136, "global function 'checkOk(_:file:line:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/Utilities.swift:43:15')
(136, "global function 'checkOk(_:file:line:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/Utilities.swift:43:15')
(136, "global function 'checkOk(_:file:line:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/Utilities.swift:43:15')
(133, "initializer 'init(bytes:startingAt:)'", '/Users/danielzheng/swift-apis/Sources/Tensor/TensorUtilities.swift:26:5')
(133, "instance method 'callAsFunction'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Layers/Normalization.swift:173:17')
(133, "instance method 'callAsFunction'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Layers/Normalization.swift:173:17')
(133, "instance method 'callAsFunction'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Layers/Normalization.swift:173:17')
(125, "initializer 'init(trace:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/LazyTensorTFFunctionBuilder.swift:45:5')
(125, "initializer 'init(trace:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/LazyTensorTFFunctionBuilder.swift:45:5')
(125, "initializer 'init(trace:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/LazyTensorTFFunctionBuilder.swift:45:5')
(125, "initializer 'init(trace:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/LazyTensorTFFunctionBuilder.swift:45:5')
(123, "initializer 'init(_owning:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/TensorHandle.swift:43:12')
(123, "initializer 'init(shape:byteCount:bufferInitializer:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/TensorHandle.swift:117:5')
(123, "initializer 'init(_owning:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/TensorHandle.swift:43:12')
(123, "initializer 'init(shape:byteCount:bufferInitializer:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/TensorHandle.swift:117:5')
(123, "initializer 'init(_owning:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/TensorHandle.swift:43:12')
(123, "initializer 'init(shape:byteCount:bufferInitializer:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/TensorHandle.swift:117:5')
(115, "instance method 'updateAttribute(description:name:attribute:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/LazyTensorTFFunctionBuilder.swift:88:18')
(115, "instance method 'updateAttribute(description:name:attribute:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/LazyTensorTFFunctionBuilder.swift:88:18')
(115, "instance method 'updateAttribute(description:name:attribute:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/LazyTensorTFFunctionBuilder.swift:88:18')
(115, "instance method 'updateAttribute(description:name:attribute:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/LazyTensorTFFunctionBuilder.swift:88:18')
(115, "global function '_vjpAcos'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:859:15')
(115, "global function '_vjpAcos'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:859:15')
(115, "global function '_vjpAcos'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:859:15')
(99, "instance method 'callAsFunction'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Layers/Recurrent.swift:229:17')
(99, "instance method 'callAsFunction'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Layers/Recurrent.swift:229:17')
(99, "instance method 'callAsFunction'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Layers/Recurrent.swift:229:17')
(96, "initializer 'init(_:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Layers/Core.swift:55:12')
(96, "initializer 'init(_:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Layers/Core.swift:55:12')
(96, "initializer 'init(_:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Layers/Core.swift:55:12')
(96, "global function 'softmaxCrossEntropy(logits:probabilities:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/BackwardsCompatibility.swift:131:13')
(96, "global function 'softmaxCrossEntropy(logits:probabilities:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/BackwardsCompatibility.swift:131:13')
(96, "global function 'softmaxCrossEntropy(logits:probabilities:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/BackwardsCompatibility.swift:131:13')
(96, "global function 'softmaxCrossEntropy(logits:probabilities:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/BackwardsCompatibility.swift:131:13')
(93, 'closure', '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/LazyTensorShapeInference.swift:136:65')
(93, 'closure', '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/LazyTensorShapeInference.swift:136:65')
(93, 'closure', '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/LazyTensorShapeInference.swift:136:65')
(93, 'closure', '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/LazyTensorShapeInference.swift:136:65')
(93, "instance method 'addInputList'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Bindings/EagerExecution.swift:67:19')
(93, "instance method 'addInputList'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Bindings/EagerExecution.swift:67:19')
(93, "instance method 'addInputList'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Bindings/EagerExecution.swift:67:19')
(93, "instance method 'addInputList'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Bindings/EagerExecution.swift:67:19')
(90, "instance method '_droppingOut(probability:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Layers/Dropout.swift:19:10')
(90, "instance method '_droppingOut(probability:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Layers/Dropout.swift:19:10')
(90, "instance method '_droppingOut(probability:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Layers/Dropout.swift:19:10')
(90, "instance method 'updateAttribute'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Bindings/EagerExecution.swift:109:19')
(90, "instance method 'updateAttribute'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Bindings/EagerExecution.swift:109:19')
(90, "instance method 'updateAttribute'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Bindings/EagerExecution.swift:109:19')
(90, "instance method 'updateAttribute'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Bindings/EagerExecution.swift:109:19')
(89, "instance method 'incrementRefCount(_:isLive:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/LazyTensorContext.swift:13:10')
(89, "instance method 'incrementRefCount(_:isLive:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/LazyTensorContext.swift:13:10')
(89, "instance method 'incrementRefCount(_:isLive:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/LazyTensorContext.swift:13:10')
(89, "instance method 'incrementRefCount(_:isLive:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/LazyTensorContext.swift:13:10')
(87, "getter 'randomSeed'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Context.swift:59:18')
(87, "getter 'randomSeed'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Context.swift:59:18')
(87, "getter 'randomSeed'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Context.swift:59:18')
(87, "getter 'randomSeed'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Context.swift:59:18')
(85, "getter '_tensorHandles'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Dataset.swift:219:52')
(85, "getter '_tensorHandles'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Dataset.swift:219:52')
(85, "getter '_tensorHandles'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Dataset.swift:219:52')
(80, "instance method 'vectorDescription(indentLevel:edgeElementCount:maxScalarLength:maxScalarCountPerLine:summarizing:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/ShapedArray.swift:212:10')
(80, "instance method 'vectorDescription(indentLevel:edgeElementCount:maxScalarLength:maxScalarCountPerLine:summarizing:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/ShapedArray.swift:212:10')
(80, "instance method 'vectorDescription(indentLevel:edgeElementCount:maxScalarLength:maxScalarCountPerLine:summarizing:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/ShapedArray.swift:212:10')
(80, "instance method 'vectorDescription(indentLevel:edgeElementCount:maxScalarLength:maxScalarCountPerLine:summarizing:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/ShapedArray.swift:212:10')
(79, "instance method 'elementsAlmostEqual(_:tolerance:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Comparison.swift:155:10')
(79, "instance method 'elementsAlmostEqual(_:tolerance:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Comparison.swift:155:10')
(79, "instance method 'elementsAlmostEqual(_:tolerance:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Comparison.swift:155:10')
(79, 'closure', '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/StringTensor.swift:66:32')
(79, 'closure', '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/StringTensor.swift:66:32')
(79, 'closure', '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/StringTensor.swift:66:32')
(77, "getter 'rank'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/TensorHandle.swift:59:9')
(77, "getter 'rank'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/TensorHandle.swift:59:9')
(77, "getter 'rank'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/TensorHandle.swift:59:9')
(75, "static method 'resourceApplyCenteredRMSProp(var_:mg:ms:mom:lr:rho:momentum:epsilon:grad:useLocking:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Bindings/RawOpsGenerated.swift:24068:20')
(75, "static method 'resourceApplyCenteredRMSProp(var_:mg:ms:mom:lr:rho:momentum:epsilon:grad:useLocking:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Bindings/RawOpsGenerated.swift:24068:20')
(75, "static method 'resourceApplyCenteredRMSProp(var_:mg:ms:mom:lr:rho:momentum:epsilon:grad:useLocking:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Bindings/RawOpsGenerated.swift:24068:20')
(75, "static method 'resourceApplyCenteredRMSProp(var_:mg:ms:mom:lr:rho:momentum:epsilon:grad:useLocking:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Bindings/RawOpsGenerated.swift:24068:20')
(74, "static method 'pow'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/StdlibExtensions.swift:89:24')
(74, "static method 'pow'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/StdlibExtensions.swift:89:24')
(74, "static method 'pow'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/StdlibExtensions.swift:89:24')
(74, "static method 'parseSingleSequenceExample(serialized:featureListDenseMissingAssumedEmpty:contextSparseKeys:contextDenseKeys:featureListSparseKeys:featureListDenseKeys:contextDenseDefaults:debugName:contextDenseShapes:featureListDenseShapes:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Bindings/RawOpsGenerated.swift:19619:20')
(74, "static method 'parseSingleSequenceExample(serialized:featureListDenseMissingAssumedEmpty:contextSparseKeys:contextDenseKeys:featureListSparseKeys:featureListDenseKeys:contextDenseDefaults:debugName:contextDenseShapes:featureListDenseShapes:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Bindings/RawOpsGenerated.swift:19619:20')
(74, "static method 'parseSingleSequenceExample(serialized:featureListDenseMissingAssumedEmpty:contextSparseKeys:contextDenseKeys:featureListSparseKeys:featureListDenseKeys:contextDenseDefaults:debugName:contextDenseShapes:featureListDenseShapes:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Bindings/RawOpsGenerated.swift:19619:20')
(74, "static method 'parseSingleSequenceExample(serialized:featureListDenseMissingAssumedEmpty:contextSparseKeys:contextDenseKeys:featureListSparseKeys:featureListDenseKeys:contextDenseDefaults:debugName:contextDenseShapes:featureListDenseShapes:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Bindings/RawOpsGenerated.swift:19619:20')
(69, "instance method 'map(parallelCallCount:_:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Dataset.swift:106:10')
(69, "instance method 'map(parallelCallCount:_:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Dataset.swift:106:10')
(69, "instance method 'map(parallelCallCount:_:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Dataset.swift:106:10')
(68, "initializer 'init(glorotUniform:seed:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Initializers.swift:523:5')
(68, "initializer 'init(glorotUniform:seed:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Initializers.swift:523:5')
(68, "initializer 'init(glorotUniform:seed:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Initializers.swift:523:5')
(61, "instance method 'updateAttribute'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/LazyTensorOperation.swift:284:10')
(61, "instance method 'updateAttribute'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/LazyTensorOperation.swift:284:10')
(61, "instance method 'updateAttribute'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/LazyTensorOperation.swift:284:10')
(61, "instance method 'updateAttribute'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Core/LazyTensorOperation.swift:284:10')
(58, "instance method 'updateAttribute'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Bindings/EagerExecution.swift:104:19')
(58, "instance method 'updateAttribute'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Bindings/EagerExecution.swift:104:19')
(58, "instance method 'updateAttribute'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Bindings/EagerExecution.swift:104:19')
(58, "instance method 'updateAttribute'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Bindings/EagerExecution.swift:104:19')
(53, "operator function '+'", 'TensorFlow.Embedding:12:28')
(53, "operator function '+'", 'TensorFlow.Embedding:12:28')
(53, "operator function '+'", 'TensorFlow.Embedding:12:28')
(53, "static method 'infeedDequeueTuple(shapes:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Bindings/RawOpsGenerated.swift:13183:20')
(53, "static method 'infeedDequeueTuple(shapes:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Bindings/RawOpsGenerated.swift:13183:20')
(53, "static method 'infeedDequeueTuple(shapes:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Bindings/RawOpsGenerated.swift:13183:20')
(53, "static method 'infeedDequeueTuple(shapes:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Bindings/RawOpsGenerated.swift:13183:20')
(52, "global function 'l1Loss(predicted:expected:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/BackwardsCompatibility.swift:25:13')
(52, "global function 'l2Loss(predicted:expected:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/BackwardsCompatibility.swift:38:13')
(52, "global function 'l1Loss(predicted:expected:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/BackwardsCompatibility.swift:25:13')
(52, "global function 'l2Loss(predicted:expected:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/BackwardsCompatibility.swift:38:13')
(52, "global function 'l1Loss(predicted:expected:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/BackwardsCompatibility.swift:25:13')
(52, "global function 'l2Loss(predicted:expected:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/BackwardsCompatibility.swift:38:13')
(52, "global function 'l1Loss(predicted:expected:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/BackwardsCompatibility.swift:25:13')
(52, "global function 'l2Loss(predicted:expected:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/BackwardsCompatibility.swift:38:13')
(52, "initializer 'init(orthogonal:gain:seed:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Initializers.swift:571:5')
(52, "initializer 'init(orthogonal:gain:seed:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Initializers.swift:571:5')
(52, "initializer 'init(orthogonal:gain:seed:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Initializers.swift:571:5')
(51, "instance method '_vjpProduct(squeezingAxes:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:2389:10')
(51, "instance method '_vjpProduct(squeezingAxes:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:2389:10')
(51, "instance method '_vjpProduct(squeezingAxes:)'", '/Users/danielzheng/swift-apis/Sources/TensorFlow/Operators/Math.swift:2389:10')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment