Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] Copyrights and link fixes #115

Merged
merged 1 commit into from
Nov 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/source/_templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@
<li class="list-title"><a href="{{ theme_variables.external_urls['resources'] }}">Resources</a></li>
<li><a href="{{ theme_variables.external_urls['docs'] }}">Docs</a></li>
<li><a href="{{ theme_variables.external_urls['github_issues'] }}" target="_blank">Github Issues</a></li>
<li><a href="https://opensource.facebook.com/legal/terms">Terms of Use</a></li>
<li><a href="https://opensource.facebook.com/legal/privacy">Privacy Policy</a></li>
</ul>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
# -- Project information -----------------------------------------------------

project = "xFormers"
copyright = "2021, Facebook AI Research"
copyright = "Copyright © 2021 Meta Platforms, Inc"
author = "Facebook AI Research"

# The full version, including alpha/beta/rc tags
Expand Down
21 changes: 9 additions & 12 deletions stubs/numpy/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.

from typing import (
Any,
Container,
Expand Down Expand Up @@ -50,13 +55,9 @@ class ndarray(_ArrayOrScalarCommon[DType, Unpack[Ts]], Iterable, Sized, Containe
order: Optional[str] = ...,
) -> None: ...
@overload
def __getitem__(
self: ndarray[DType, A1, A2], key: Literal[0]
) -> ndarray[DType, A2]: ...
def __getitem__(self: ndarray[DType, A1, A2], key: Literal[0]) -> ndarray[DType, A2]: ...
@overload
def __getitem__(
self: ndarray[DType, A1, A2], key: Literal[1]
) -> ndarray[DType, A1]: ...
def __getitem__(self: ndarray[DType, A1, A2], key: Literal[1]) -> ndarray[DType, A1]: ...
def __setitem__(self, key, value): ...
@property
def shape(self) -> Tuple[Unpack[Ts]]: ...
Expand All @@ -81,15 +82,11 @@ class ndarray(_ArrayOrScalarCommon[DType, Unpack[Ts]], Iterable, Sized, Containe
# ===== BEGIN `empty` =====
# `shape` as tuple, dtype="int64"
@overload
def empty(
shape: Tuple[Unpack[Ts]], dtype: Literal["int64"]
) -> ndarray[int64, Unpack[Ts]]: ...
def empty(shape: Tuple[Unpack[Ts]], dtype: Literal["int64"]) -> ndarray[int64, Unpack[Ts]]: ...

# `shape` as tuple, dtype as e.g. np.float32
@overload
def empty(
shape: Tuple[Unpack[Ts]], dtype: Type[DType]
) -> ndarray[DType, Unpack[Ts]]: ...
def empty(shape: Tuple[Unpack[Ts]], dtype: Type[DType]) -> ndarray[DType, Unpack[Ts]]: ...

# `shape` as integer, dtype as e.g. np.float32
@overload
Expand Down
5 changes: 5 additions & 0 deletions stubs/torch/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.

import builtins
from typing import (
Any,
Expand Down
5 changes: 5 additions & 0 deletions stubs/torch/autograd/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.

from typing import Any, Optional, Sequence, Union

import torch
Expand Down
5 changes: 5 additions & 0 deletions stubs/torch/autograd/profiler.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.

import contextlib
from typing import Any

Expand Down
5 changes: 5 additions & 0 deletions stubs/torch/cuda/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.

from typing import Any

def __getattr__(name) -> Any: ...
5 changes: 5 additions & 0 deletions stubs/torch/fft/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.

from typing import Optional, Tuple, TypeVar, overload

from pyre_extensions import TypeVarTuple, Unpack
Expand Down
5 changes: 5 additions & 0 deletions stubs/torch/hub.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.

from typing import Any

download_url_to_file = Any
Expand Down
17 changes: 8 additions & 9 deletions stubs/torch/linalg/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.

from typing import Optional, Tuple, TypeVar, overload

from pyre_extensions import TypeVarTuple, Unpack
Expand Down Expand Up @@ -32,9 +37,7 @@ def qr(
mode: L["complete"],
*,
out: Optional[Tensor] = ...,
) -> Tuple[
Tensor[FloatOrDouble, Unpack[Ts], M, M], Tensor[FloatOrDouble, Unpack[Ts], M, N]
]: ...
) -> Tuple[Tensor[FloatOrDouble, Unpack[Ts], M, M], Tensor[FloatOrDouble, Unpack[Ts], M, N]]: ...

# The return type should use k=min(m, n), but we don't have that operator yet.
# Assume that M <= N for now.
Expand All @@ -44,10 +47,6 @@ def qr(
mode: L["reduced"] = ...,
*,
out: Optional[Tensor] = ...,
) -> Tuple[
Tensor[FloatOrDouble, Unpack[Ts], M, M], Tensor[FloatOrDouble, Unpack[Ts], M, N]
]: ...
) -> Tuple[Tensor[FloatOrDouble, Unpack[Ts], M, M], Tensor[FloatOrDouble, Unpack[Ts], M, N]]: ...
@overload
def norm(
A: Tensor[DType, Unpack[Ts], N, M], dim: Tuple[L[-2], L[-1]]
) -> Tensor[DType, Unpack[Ts]]: ...
def norm(A: Tensor[DType, Unpack[Ts], N, M], dim: Tuple[L[-2], L[-1]]) -> Tensor[DType, Unpack[Ts]]: ...
45 changes: 14 additions & 31 deletions stubs/torch/nn/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.

import builtins
from typing import (
Any,
Expand Down Expand Up @@ -42,21 +47,15 @@ class Module:
training: bool = ...

class LSTMCell(Module, Generic[InputSize, HiddenSize]):
def __init__(
self, input_size: InputSize, hidden_size: HiddenSize, bias: bool = ...
) -> None: ...
def __init__(self, input_size: InputSize, hidden_size: HiddenSize, bias: bool = ...) -> None: ...
def __call__(
self,
input: Tensor[DType, Batch, InputSize],
hidden: Tuple[
Tensor[DType, Batch, HiddenSize], Tensor[DType, Batch, HiddenSize]
] = ...,
hidden: Tuple[Tensor[DType, Batch, HiddenSize], Tensor[DType, Batch, HiddenSize]] = ...,
) -> Tuple[Tensor[DType, Batch, HiddenSize], Tensor[DType, Batch, HiddenSize]]: ...

class Linear(Module, Generic[InputSize, OutputSize]):
def __init__(
self, in_features: InputSize, out_features: OutputSize, bias: bool = ...
) -> None: ...
def __init__(self, in_features: InputSize, out_features: OutputSize, bias: bool = ...) -> None: ...
def __call__(
self,
input: Tensor[DType, N, Unpack[Ts], InputSize],
Expand Down Expand Up @@ -123,13 +122,7 @@ class ReflectionPad2d(Module, Generic[Padding]):
def __call__(
self,
input: Tensor[DType, Batch, Channels, Height, Width],
) -> Tensor[
DType,
Batch,
Channels,
Add[Add[Height, Padding], Padding],
Add[Add[Width, Padding], Padding],
]: ...
) -> Tensor[DType, Batch, Channels, Add[Add[Height, Padding], Padding], Add[Add[Width, Padding], Padding],]: ...

class InstanceNorm2d(Generic[Channels]):
def __init__(self, num_features: Channels, affine: bool = False) -> None: ...
Expand All @@ -139,9 +132,7 @@ class InstanceNorm2d(Generic[Channels]):

class LeakyReLU(Module):
def __init__(self, negative_slope: float = ..., inplace: bool = ...) -> None: ...
def __call__(
self, input: Tensor[DType, N, Unpack[Ts]]
) -> Tensor[DType, N, Unpack[Ts]]: ...
def __call__(self, input: Tensor[DType, N, Unpack[Ts]]) -> Tensor[DType, N, Unpack[Ts]]: ...

class ReLU(Module):
def __call__(
Expand All @@ -155,9 +146,7 @@ class GELU(Module):

class Dropout(Module):
def __init__(self, p: float, inplace: bool = ...) -> None: ...
def __call__(
self, input: Tensor[DType, Unpack[Ts]]
) -> Tensor[DType, Unpack[Ts]]: ...
def __call__(self, input: Tensor[DType, Unpack[Ts]]) -> Tensor[DType, Unpack[Ts]]: ...

class Embedding(Module, Generic[N, EmbeddingDimension]):
def __init__(
Expand Down Expand Up @@ -194,12 +183,8 @@ class Embedding(Module, Generic[N, EmbeddingDimension]):
scale_grad_by_freq: bool = False,
sparse: bool = False,
) -> Embedding[N, EmbeddingDimension]: ...
def forward(
self, x: Tensor[DType, Unpack[Ts]]
) -> Tensor[DType, Unpack[Ts], EmbeddingDimension]: ...
def __call__(
self, x: Tensor[DType, Unpack[Ts]]
) -> Tensor[DType, Unpack[Ts], EmbeddingDimension]: ...
def forward(self, x: Tensor[DType, Unpack[Ts]]) -> Tensor[DType, Unpack[Ts], EmbeddingDimension]: ...
def __call__(self, x: Tensor[DType, Unpack[Ts]]) -> Tensor[DType, Unpack[Ts], EmbeddingDimension]: ...

_shape_t = Union[int, List[int], Tuple[Any, ...]]

Expand Down Expand Up @@ -256,8 +241,6 @@ class ModuleList(Module):
def __len__(self) -> int: ...

class Parameter(Tensor[DType, Unpack[Ts]]):
def __init__(
self, data: Tensor[DType, Unpack[Ts]] = ..., requires_grad: builtins.bool = ...
) -> None: ...
def __init__(self, data: Tensor[DType, Unpack[Ts]] = ..., requires_grad: builtins.bool = ...) -> None: ...

Sequential: Any = ...
5 changes: 5 additions & 0 deletions stubs/torch/nn/functional.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.

from typing import Tuple, TypeVar, overload

import torch
Expand Down
5 changes: 5 additions & 0 deletions stubs/torch/nn/functional/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.

from typing import Tuple, TypeVar, overload

import torch
Expand Down
17 changes: 8 additions & 9 deletions stubs/torch/nn/init.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.

from typing import Tuple, TypeVar

import torch
Expand All @@ -8,17 +13,11 @@ Ts = TypeVarTuple("Ts")
DType = TypeVar("DType")

def _calculate_fan_in_and_fan_out(tensor: Tensor) -> Tuple[int, int]: ...
def constant_(
tensor: Tensor[DType, Unpack[Ts]], val: float
) -> Tensor[DType, Unpack[Ts]]: ...
def constant_(tensor: Tensor[DType, Unpack[Ts]], val: float) -> Tensor[DType, Unpack[Ts]]: ...
def kaiming_uniform_(
tensor: Tensor[DType, Unpack[Ts]], a=0, mode="fan_in", nonlinearity="leaky_relu"
) -> Tensor[DType, Unpack[Ts]]: ...
def normal_(
tensor: Tensor[DType, Unpack[Ts]], mean: float = ..., std: float = ...
) -> Tensor[DType, Unpack[Ts]]: ...
def uniform_(
tensor: Tensor[DType, Unpack[Ts]], a: float = ..., b: float = ...
) -> Tensor[DType, Unpack[Ts]]: ...
def normal_(tensor: Tensor[DType, Unpack[Ts]], mean: float = ..., std: float = ...) -> Tensor[DType, Unpack[Ts]]: ...
def uniform_(tensor: Tensor[DType, Unpack[Ts]], a: float = ..., b: float = ...) -> Tensor[DType, Unpack[Ts]]: ...
def _no_grad_uniform_(tensor: Tensor, a, b): ...
def xavier_uniform_(tensor: Tensor, gain: float = ...) -> Tensor: ...
11 changes: 8 additions & 3 deletions stubs/torch/nn/utils/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
from typing import Iterable, TypeVar, Union, overload
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.

from pyre_extensions import TypeVarTuple, Unpack
from torch import Tensor, complex64
from typing import Iterable, TypeVar, Union

from pyre_extensions import TypeVarTuple
from torch import Tensor

DType = TypeVar("DType")

Expand Down
4 changes: 4 additions & 0 deletions stubs/torch/onnx.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.
5 changes: 5 additions & 0 deletions stubs/torch/ops.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.

from typing import Any

def __getattr__(name) -> Any: ...
5 changes: 5 additions & 0 deletions stubs/torch/optim/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.

from typing import Any

def __getattr__(name) -> Any: ...
5 changes: 5 additions & 0 deletions stubs/torch/profiler/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.

from typing import Any

def __getattr__(name) -> Any: ...
5 changes: 5 additions & 0 deletions stubs/torch/random/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.

from typing import Any

def initial_seed() -> int: ...
Expand Down
16 changes: 8 additions & 8 deletions stubs/torch/sparse/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
from typing import Optional, Type, TypeVar, overload
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.

from typing import Optional, TypeVar, overload

from numpy import ndarray
from pyre_extensions import TypeVarTuple, Unpack
from torch import Tensor
from typing_extensions import Literal as L
Expand All @@ -12,10 +16,6 @@ DType2 = TypeVar("DType2")

Ts = TypeVarTuple("Ts")
@overload
def softmax(
input: Tensor[DType, Unpack[Ts]], dim: int, dtype: Optional[DType2]
) -> Tensor[DType2, Unpack[Ts]]: ...
def softmax(input: Tensor[DType, Unpack[Ts]], dim: int, dtype: Optional[DType2]) -> Tensor[DType2, Unpack[Ts]]: ...
@overload
def softmax(
input: Tensor[DType, Unpack[Ts]], dim: int, dtype: Optional[DType] = ...
) -> Tensor[DType, Unpack[Ts]]: ...
def softmax(input: Tensor[DType, Unpack[Ts]], dim: int, dtype: Optional[DType] = ...) -> Tensor[DType, Unpack[Ts]]: ...
5 changes: 5 additions & 0 deletions stubs/torch/utils/data.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.

from typing import Any

DataLoader = Any
5 changes: 5 additions & 0 deletions stubs/torch/utils/model_zoo.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
#
# This source code is licensed under the BSD license found in the
# LICENSE file in the root directory of this source tree.

from typing import Any

_download_url_to_file = Any
Loading